Running Only One Shoulda Rails Test

To run only one test in a shoulda test file, use a regular expression to match the shoulda context. If you have a context like:

context "parsing German Klavier" do
  setup do
    #...
  end
  
  should "have the correct parsed data" do
    # lots of assertions
  end

  should "validate the definition" do
    # more assertions
  end
end 

in a file full of other contexts, you can just run this context by doing:

ruby test/unit/word_test.rb -n /Klavier/

Much easier than looking for the results of one failing test in a list of hundreds…


Related Posts

  1. Rails Fragment Caching With Multiple Accounts
  2. iPhone/iPad UISearchBar and UISearchDisplayController Asynchronous Example
  3. SPF Records with Rails and ActionMailer
  4. Autotest with Rails Tip -- Ignore Files for Less CPU Usage
  5. My 5 Must-have vim Plugins
You should follow me on Twitter: @patrickxb