Back

Rails test a single directory or section

added on :: 21 June 2014
To test a single directory rather than the entire test suite. e.g  to test your beautiful "test/models"  directory say:


rake test:models

If you want to test a single file




rake test TEST=test/integration/pages_test.rb

If you cannot be bothered to type "bundle exec rake test" or "test" all the time, best to keep a little snipet in your beloved bash_profile (Users/ypurnicename/.bash_profile) file"


alias t='bundle exec rake test'

Then you can just type 't' to run the entire test suite and be happy.

As for test log  or have a shortcut for it;

alias ttl=' tail -f log/test.log'


 To test a directory ie:controllers


rake test:controllers
or
rake test:models
Back