Sign-out current user when calling `sign_in` in tests and fix an example that only passes on retry
What does this MR do?
- This monkey-patch
Devise::Test::ControllerHelpers#sign_in
to clear out the:"@current_#{scope}"
controller instance variable so that the previously logged-in user isn't reused upon retries (when usingrspec-retry
).- I raised the issue upstream here: https://github.com/heartcombo/devise/issues/5190.
- This also fix a test that was only passing on retry due to the above bug (i.e. when only the
Devise::Test::ControllerHelpers#sign_in
bug is fixed, the test doesn't pass, even on retries).- The permission was changed with 6d7002d0 but due to the above bug, the test would still pass upon retries.
Does this MR meet the acceptance criteria?
Conformity
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Separation of EE specific content
Closes #202072 (closed).
Edited by Rémy Coutable