При выполнении простого теста RSpec для пользовательского SessionsController я получаю сообщение об ошибке Warden :: Proxy:
Devise could not find the `Warden::Proxy` instance on your request environment.
Я пытался добавить
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Warden::Test::Helpers
кrails_helper.rb.
Я также добавил
include Devise::Controllers::Helpers
include Devise::Test::ControllerHelpers
RSpec.describe SessionsController, type: :controller do
include Devise::Controllers::Helpers
include Devise::Test::ControllerHelpers
it "should show login page" do
get :new
expect(response.status).to eq(200)
end
end
1) SessionsController should show login page
Failure/Error: request.env['warden'] or raise MissingWarden
Devise::MissingWarden:
Devise could not find the `Warden::Proxy` instance on your request environment.
Make sure that your application is loading Devise and Warden as expected and that the `Warden::Manager` middleware is present in your middleware stack.
If you are seeing this on one of your tests, ensure that your tests are either executing the Rails middleware stack or that your tests are using the `Devise::Test::ControllerHelpers` module to inject the `request.env['warden']` object for you.