Search code examples
ruby-on-railsdebuggingrspecbreakpoints

breakpoints in methods during rspec tests


I'd like to start debugger in methods during rspec test. I know, I can do it in the spec (like in this question), I have --debug in my .rspec file.

I'd like to put debugger in a methods that is under tests:

it "should be OK" do
    User.ok? should be_true
end

class User
    def ok?
        do_something
        debugger      #here is my breakpoint
        do_something
    end
end

When I do something similar to that example and run rspec (using rake spec or guard or rspec) the breakpoind doesn't work.


Solution

  • You should put your debugger gem under the :test group in your gemfile.

    gem 'debugger', group: [:development, :test]