ActiveTest: TestHelper Bug Fix

Posted by Mathew Abonyi Sun, 26 Nov 2006 21:46:18 GMT

There was an issue with test_helper variables set on Test::Unit::TestCase not being set properly. Values would always be the default because of the way class inherited attributes are passed down the hierarchy. You now need to require the active_test framework and any other plugins you have installed at the end of RAILS_ROOT/test/test_helper.rb.

Also, plugin developers should never require their libraries through init. Instead, there should be a file with the name of their plugin in PLUGIN_ROOT/lib. For example, active_test_authentication has a file at PLUGIN_ROOT/lib/active_test_authentication.rb. This is the file which is loaded when `require ‘active_test_authentication’` is called at the end of test_helper.

This fix actually alleviates more than google issue 2. When loaded plugins with a name lexicographically earlier than active_test, active_test would automatically be loaded. This is trivial, but not intended. In any case, you must now require both the active_test framework and any plugins you use at the end of test_helper.

Posted in , ,  | no comments | no trackbacks

Comments

Trackbacks

Use the following link to trackback from your own site:
http://www.mathewabonyi.com/articles/trackback/30

Comments are disabled