Forum: Ruby Running a specific test in a test file.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9239e324751b8db551789e5e16689438?d=identicon&s=25 Hunt Jon (Guest)
on 2008-12-15 13:48
(Received via mailing list)
I remember there was a way to run a specific test from a test file.

    ruby test_file.rb

Runs the all the tests. How can I select one from this?

Also is there any complete reference on this (which argument the ruby
command takes when running test files)?

Ed437e52d8d6720308720e7e678f3e6d?d=identicon&s=25 Patrick Doyle (Guest)
on 2008-12-15 14:47
(Received via mailing list)
On Mon, Dec 15, 2008 at 7:40 AM, Hunt Jon <>

> Are you talking about a Ruby on Rails application?  If so, try:

$ cd test
$ ruby unit/<<name of model>>_test.rb

If you want to run a specific test (that you have defined, say in
mymodel.rb), you can run

$ ruby unit/mymodel.rb -n test_min_is_less_than_max

assuming you want to run the "min is less than max" text, also known as

At least, that's what works for me :-)

This topic is locked and can not be replied to.