Skip to content

Commit bbd4d45

Browse files
committed
Add sign_out helper for request specs
It's not often this is necessary, but when there is shared state that needs to be undone it may be necessary. Prior to this the same thing can be accomplished using `sign_in nil` but that's a bit clunky. This adds the more intentional revealing `sign_out` helper, which also provides better interface parity between the spec types.
1 parent ee81826 commit bbd4d45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/kracken/rspec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ def sign_in(user = nil)
1717
Kracken::SpecHelper.current_user = user
1818
end
1919

20+
def sign_out(_ignored = nil)
21+
Kracken::SpecHelper.current_user = nil
22+
end
23+
2024
def token_authorize(user, token:)
2125
Kracken::Controllers::TokenAuthenticatable::cache_valid_auth(token, force: true) do
2226
{ id: user.id, team_ids: user.team_ids }
@@ -29,7 +33,7 @@ def sign_in(user = nil)
2933
Kracken::SpecHelper.current_user = user
3034
end
3135

32-
def sign_out(ignored = nil)
36+
def sign_out(_ignored = nil)
3337
Kracken::SpecHelper.current_user = nil
3438
end
3539

0 commit comments

Comments
 (0)