I have this step definition:
Given /^I am not logged in$/ do
visit '/users/sign_out'
end
And rake routes gives me this:
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
So.. How would I test this? Is there any way I can add the HTTP method in Capybara?
I say this because I keep getting this error in my tests:
No route matches [GET] "/users/sign_out" (ActionController::RoutingError)
Change:
config.sign_out_via = :delete
for
config.sign_out_via = Rails.env.test? ? :get : :delete
in config/initializers/devise.rb
As explained in Rails-Devise-Rspec-Cucumber tutorial, by doing so, you are going to make Devise to do GET requests for sign out actions. And this is just going to happen in test environments...