Rails 3.0.9 + Devise + Cucumber + Capybara the infamous “No route matches /users/sign_out”

后端 未结 6 1804
我寻月下人不归
我寻月下人不归 2021-02-02 09:27

I am using devise 1.4.2 with rails 3.0.9, cucumber-rails 1.0.2, capybara 1.0.0. I got No route matches \"/users/sign_out\" error when I clicked logout. I added

6条回答
  •  自闭症患者
    2021-02-02 10:14

    When i need use something like this in test.env:

      visit destroy_user_session_path
    

    it's work for me, but maybe this is not right)

    config/init/devise.rb

      # The default HTTP method used to sign out a resource. Default is :delete.
      if Rails.env.test?
        config.sign_out_via = :get
      else
        config.sign_out_via = :delete
      end
    

提交回复
热议问题