How to run a single RSpec test?
With Rake:
rake spec SPEC=path/to/spec.rb
(Credit goes to this answer. Go vote him up.)
EDIT (thanks to @cirosantilli): To run one specific scenario within the spec, you have to supply a regex pattern match that matches the description.
rake spec SPEC=path/to/spec.rb \
SPEC_OPTS="-e \"should be successful and return 3 items\""
Usually I do:
rspec ./spec/controllers/groups_controller_spec.rb:42
Where 42
represents the line of the test I want to run.
You can also use tags. See here.
Using bundle exec
:
bundle exec rspec ./spec/controllers/groups_controller_spec.rb:42