Skip to content

Sign-out current user when calling `sign_in` in tests and fix an example that only passes on retry

Rémy Coutable requested to merge 202072-fix-flaky-examples into master

What does this MR do?

  1. 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 using rspec-retry).
  2. 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

Closes #202072 (closed).

Edited by Rémy Coutable

Merge request reports

Loading