Thursday, April 2, 2009

Running tests in the command line on Ruby on Rails

I normally run the test suite for my Ruby on Rails projects using the Netbeans test interface.

Unfortunately this interface is only useful to run the whole suite. It does not offer (as it does for Java) the possibility to run a single test class or a single test from a test class.

When I need to this I just go to the command line and type:

ruby test/functional/accounts_controller_test.rb

But what if I need to run one single test from this test class?
No problem, it is actually very easy. Just type:

ruby test/functional/accounts_controller_test.rb --name test_should_create_account

That's it!

You can also find this article on definenull.com.

No comments: