如何在 rspec 上没有监狱长回调的情况下登录(请求规范)

How to sign in without warden callback on rspec (request spec)

我想根据请求规范致电 sign_in(user),无需 warden 回电。
有人知道解决方法吗?

我想根据要求规范使用 bypass_sign_in 之类的东西。

我在下面试过了。

config.include Devise::Test::IntegrationHelpers, type: :feature
RSpec.describe '/ajax/stores', type: :request do
    context 'login as valid user' do
      it do
        sign_in(user)
      end
    end
end
RSpec.describe '/ajax/stores', type: :request do
    context 'login as valid user' do
      it do
        login_as(user, bypass: true)
      end
    end
end

您可以将 run_callbacks: false 选项传递给 Warden 的 login_as 助手:

login_as(user, run_callbacks: false)