1

I'm trying to run a cucumber test involving Devise and the code below is failing:

When /^I logout$/ do
   page.driver.submit :delete, destroy_user_session_path, {}
end

The error message I receive is:

No route matches [GET] "/" (ActionController::RoutingError)
./features/steps/authentication_steps.rb:16:in `/^I logout$/'
./features/steps/authentication_steps.rb:11:in `/^I am not logged in$/
features/authentication_admin.feature:8:in `And I am not logged in'

However, the route does appear in my routes when I do a rake routes RAILS_ENV=test

destroy_user_session DELETE /users/sign_out(.:format)    devise/sessions#destroy

Any ideas to help me debug? Thanks!

Winston Kotzan
  • 1,979
  • 20
  • 25

1 Answers1

1

IMO - Devise is a well-tested gem. Probably no point to test logout method.

I'd rather test presence of logout button with correct href using RSpec.

Or use Warden test mode in Controller Spec - in case you want to test some specific behavior.

Serge Vinogradoff
  • 2,262
  • 4
  • 26
  • 42
  • I'm not testing Devise. This is one cucumber step which I need to set the scenario in a logged out state. I will then have subsequent steps to test other custom built functionality. – Winston Kotzan Oct 23 '13 at 01:17
  • by golly that's it! I didn't have the root pointing to anything because this is just an admin panel for another app, and thus no homepage. I fixed it by setting up a controller that renders HTTP 200 for any root requests. Thanks for helping me see that! – Winston Kotzan Oct 23 '13 at 02:54