When using rspec-retry, the currently logged-in user isn't totally reset, i.e. @controller.instance_variable_get(:"@current_#{scope}") still returns the user logged-in in the first try. This can lead to failures/false positive, e.g. https://gitlab.com/gitlab-org/gitlab/issues/202072.
Expected behavior
Current user should be cleared when logging-in a new user, upon example retry.
I have applied the following patch locally:
module ControllerHelpers
def sign_in(resource, deprecated = nil, scope: nil)
super
scope ||= Devise::Mapping.find_scope!(resource)
@controller.instance_variable_set(:"@current_#{scope}", nil)
end
end
Devise::Test::ControllerHelpers.prepend(ControllerHelpers)
Environment
Current behavior
When using
rspec-retry
, the currently logged-in user isn't totally reset, i.e.@controller.instance_variable_get(:"@current_#{scope}")
still returns the user logged-in in the first try. This can lead to failures/false positive, e.g. https://gitlab.com/gitlab-org/gitlab/issues/202072.Expected behavior
Current user should be cleared when logging-in a new user, upon example retry.
I have applied the following patch locally: