Skip to content

Commit 158a7c1

Browse files
committed
Fix state cleanup
This is a 🔨 for ensuring the `current_user` state is cleared. Currently we are missing clearing this on `feature` and the new `system` tests. We could add more `before(:type)` blocks to clear the state. But that would also mean we may not clear the state when someone else manually includes the helper. As we already have a generic `before(:example)` hook to clear the token auth, there isn't a lot of additional overhead to use this to also clear the `current_user` state. This also ensures we clear everything even for those cases where the module was manually included.
1 parent cfd65bd commit 158a7c1

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

lib/kracken/rspec.rb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,7 @@ def authenticate_user_with_token!
8080

8181
c.before do
8282
Kracken::Controllers::TokenAuthenticatable.clear_auth_cache
83-
end
84-
85-
c.before(type: :kracken) do
86-
Kracken::SpecHelper.current_user = nil
87-
end
88-
89-
c.before(type: :controller) do
90-
Kracken::SpecHelper.current_user = nil
91-
end
92-
93-
c.before(type: :request) do
94-
Kracken::SpecHelper.current_user = nil
83+
Kracken::SpecHelper.current_user = nil
9584
end
9685
end
9786
end

0 commit comments

Comments
 (0)