Rss Feed Tweeter button Facebook button Technorati button Reddit button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button

A Waage Blog

Ruby, Rails, Life

RSpec – Running One Single Test at a Time

without comments

In the old days I would pass a regular expression to run a particular unit test or group of similarly named unit tests by name.

Here’s the easy way to run one test in RSpec… by line number!
Look at the line-number of any RSpec block (it, describe, etc), and simply run the rspec command, passing in the [filename]:[line number]:

$ rspec models/user_spec.rb:27

Happy testing!

Written by Andrew Waage

July 11th, 2011 at 3:03 pm

Leave a Reply