NOTE. This does not run the test through rake . This way, any code you have in the Rakefile will NOT be executed.
To run a single test, use the following command in the rails project main directory:
ruby -I test test/unit/my_model_test.rb -n test_name
This runs a single test named "name" defined in the MyModelTest class in the specified file. The name test_ is formed by entering a test name, adding it to the word "test", and then separating the words with underscores. For example:
class MyModelTest < ActiveSupport::TestCase test "valid with good attributes" do
You can run both tests with:
ruby -I test test/unit/my_model_test.rb
and only the second test through
ruby -I test test/unit/my_model_test.rb -n test_invalid_with_bad_attributes
Darryl 01 Oct '09 at 23:44 2009-10-01 23:44
source share