Search code examples
ruby-on-rails-3.1devisetddruby-debug

Debugging controller methods by running functional tests


I am in a situation where I need to step through the controller method when I run a functional test. I use ruby-debug to debug through my application. My app is a rails 3.1 app which uses ruby-1.8.7 . I can debug my code by using

rails server --debugger OR rails console --debugger

I can also stop the code by inserting "debugger" in a model and run it's respective unit test.

But I am not able to do the same thing with the controllers. That is I am not able to stop the code by inserting "debugger" in the methods of the controller and run it's respective functional test.

Has anyone faced this issue before?

Also I use devise for authentication so I need to add the following lines to my test_helper

class ActionController::TestCase
  include Devise::TestHelpers

  def login_user
    @request.env["devise.mapping"] = Devise.mappings[:user]
    @user.confirm!
    sign_in @user
  end
end

Not sure I that is going to effect the debugger in anyway.


Solution

  • I was unable to stop at a debugger inserted in my controller method when I ran the functional tests because I was hitting a before_filter