Jason Meridth

I am a continuously learning senior full stack SDE/SRE trying to not let best be the enemy of better.

Buy me a coffeeBuy me a coffee

Run a Specific RSpec Spec

23 Mar 2013 » » testing, tools, rspec

Update: You can specify a line number to run in your spec if you’re wanting to run a specific spec. Example: rspec spec/controllers/sessions_controller_spec.rb:90

Tired of looking this up and want to use my writing part of my brain to blog it:

rake spec SPEC=spec/controllers/sessions_controller_spec.rb \
  SPEC_OPTS="-e \"should log in with cookie\""

This is importatnt to me while coding Rails because if I just run

rspec specs/controllers/sessions_controller_spec.rb

the test database isn’t cleared out. By running rake spec I get that.