Skip to content

Commit

Permalink
refactor login user calls
Browse files Browse the repository at this point in the history
  • Loading branch information
yksflip committed Dec 5, 2022
1 parent 8c962e5 commit de326e5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec/controllers/concerns/auth_concern_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ def call_login
let(:token_msg) { token_verifier.generate }
let(:user) { create :user }

before { login user }

it 'authenticates token' do
login user
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
get_with_defaults :try_authenticate_or_token, params: { token: token_msg }
expect(response).not_to have_http_status(:redirect)
end

it 'redirects on faulty token' do
login user
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
get_with_defaults :try_authenticate_or_token, params: { token: 'abc' }
expect(response).to have_http_status(:redirect)
Expand All @@ -203,7 +203,6 @@ def call_login
end

it 'authenticates current user on empty token' do
login user
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
get_with_defaults :try_authenticate_or_token
expect(response).to have_http_status(:success)
Expand Down

0 comments on commit de326e5

Please sign in to comment.