I\'m trying to get Ruby debugger running in one of my specs:
describe User do
it \"should be valid\" do
debugger
User.new.should be_valid
end
end
The best and cleanest option is to use --require in your .rspec file. What you put depends on which gem you use for debugging.
--color
--require pry
--require rails_helper
These correspond to command line options (-d or --debug is now deprecated).
Feel free to use debugger, ruby-debug or pry (pry-rails in your Gemfile).
For your Gemfile:
group :test, :development do
gem 'pry-rails'
end
Putting require 'ruby-debug' etc. at the top of your spec is simply more tightly coupled -- especially since here the top voted comment suggests putting it individually in ALL your files. With the new .rspec file you shouldn't need to put require 'spec_helper' or require 'rails_helper' at the top of your files anymore.
They make more sense as implicit command line arguments.