Howto invoke individual test for RubyOnRails 2.3.x

The snippet said it all:

cd project
ruby -I test/unit/product_test.rb

The code above would run all test cases of Product unit test. You can do the same for functional and other tests.
What if you only want to run a specific test case? Easy, you just specify the test name after -n flag

# unit/product_test.rb

test "true lies" do
  assert true
end

If you test has the test case ‘true lies’, the test name would be ‘true_lies’

cd project
ruby -I test/unit/product_test.rb -n test_true_lies
Advertisements

About Jones Lee

Nothing much about me..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: