Applying a focus during rspec testing to test just one specific area

Public, Command Line, Testing / TDD

harrylevine

Created: Oct 28, 2014     Updated: Nov 24, 2014


add , focus: true on the area to be tested. You can use any word here, instead of focus. (i.e. foobar)

describe "the root page", focus: true do
  visit "/"
end

Then to run the rspec on just that focussed area you type into the command line rspec -t focus, like this:

$ rspec -t focus