==Introduction
Ruby On Rails plugin to use helper modules in testing (Test::Unit). This
is especially useful when you have factory methods or utility methods in your test code
that you'd like to be able to share between multiple test files (and you
don't want to clutter your test_helper.rb).
This plugin is just an extension of
http://faithfulcode.rubyforge.org/svn/plugins/trunk/test_helpers/ with modifications for
my own tastes and a generator for easy addition of test helpers.
Author: Brian Smith (bsmith@swig505.com)
Date: December 2007
==Overview
The built in testing framework for Ruby On Rails (Test::Unit) does
not use helper modules for testing. This plugin allows you to create
a directory ('test/helpers') and place helper modules in the directory.
You can create a helper module with the following command (that will
create a file <tt>test/helpers/<name>_test_helper.rb</tt>).
script/generate test_helper <name>
Each helper module can be loaded with:
test_helper :<name>
Additionally, you could place the following within test_helper.rb to
automatically load all test helper modules:
test_helpers :all
NOTE: <tt>test_helper</tt> and <tt>test_helpers</tt> are aliases
==Example
If you had a unit test file called "user_test.rb" in test/units, you
could create the file "test/helpers/user_test_helper.rb" with the following:
ruby script/generate test_helper user
The "test/helpers/user_test_helper.rb" file that is created will contain the
following:
<tt>
module UserTestHelper
end
</tt>
Then, within "test/unit/user_test.rb", you would place the following:
test_helper :user