Last Updated: February 25, 2016
·
458
· ck3g

Run focused specs

There are several options for running focused specs.

By appending the line number of it, context or describe methods to the file name:

$ rspec spec/models/foo_spec.rb:10

By passing the line number to the -l more than once:

$ rspec spec/models/foo_spec.rb -l 10 -l 40

Using your own tag for describe, context and it methods:

it "has a valid factory", focus: true do
  expect(create :foo).to be_valid
end

$ rspec spec/models/foo_spec.rb -t focus

Run examples whose full nested names include string:

$ rspec spec/models/foo_spec -e when