I am reviewing rspec tests and trying to understand what the following code does.
before do
@request.env["devise.mapping"] = Devise.mappings[:user]
setup_controller_for_warden
@user = create(:user)
end
I am reviewing rspec tests and trying to understand what the following code does.
before do
@request.env["devise.mapping"] = Devise.mappings[:user]
setup_controller_for_warden
@user = create(:user)
end
Devise documentation suggests adding the
@request.env["devise.mapping"] = Devise.mappings[:user]
when you are testing a Devise controller or a controller that inherits from a Devise controller:And also the gem itself warns you about it in some cases: