sentient_user
sentient_user copied to clipboard
Clear User.current after controller actions
Tests suites might get flaky when User.current is not cleanup after tests
In the "normal" Rails request/response lifecycle it's not needed to clear User.current after a request has been processed (since it will reset on each new request). However, in tests this not the case. If we have an integration/system test that sets User.current and then afterwards we run a non-controller test (e.g. a background job test etc) we get unexpected behavior.