Description
Hello,
I'm not sure if I'm in the right place, I have a problem with devise strategies and rspec after Rails update to version 8.0.1.
We have a custom strategy which we load into the devise strategies (see below) and it does work fine on development/production and test when I run all test from one file at once. The strategies are all loaded in the manager
and are found in proxy.rb
to run the correct authenticate!
in our custom strategy.
When I run a specific test like rspec spec/requests/foo/create_spec.rb:123
, then the manager
default_strategies are always empty and the test stops at the authentication.
I have seen others have similar problems when running one test: #5752 (comment)
Has someone an Idea?
require 'devise/strategies/cookie_auth'
module Devise
module Models
module CookieAuth
extend ActiveSupport::Concern
end
end
end
module Devise
module Strategies
class CookieAuth < Warden::Strategies::Base
def valid?
!cookies[:access_token].nil?
end
def authenticate!
...
end
def store?
false
end
end
end
end
Warden::Strategies.add(:cookie_auth, Devise::Strategies::CookieAuth)
Devise.add_module(:cookie_auth, {
strategy: true,
controller: :sessions,
model: 'devise/models/cookie_auth',
route: :session
})
devise (4.9.4)
rails (8.0.1) (with 8.0.2 it's not better)
rspec-core (3.13.3)
rspec-rails (7.1.1)