Monday, May 13, 2013

AbstractController::ActionNotFound:


       Could not find devise mapping for path "/users/sign_in?user%5Bemail%5D=bparanj%40gmail.com&user%5Bpassword%5D=secret".
       This may happen for two reasons:
     
       1) You forgot to wrap your route inside the scope block. For example:
     
         devise_scope :user do
           get "/some/route" => "some_devise_controller"
         end
     
       2) You are testing a Devise controller bypassing the router.
          If so, you can explicitly tell Devise which mapping to use:
     
          @request.env["devise.mapping"] = Devise.mappings[:user]

Solution:


  before :each do
    request.env['devise.mapping'] = Devise.mappings[:user]
  end