refactor login user calls

This commit is contained in:
Philipp Rothmann 2022-12-05 17:23:44 +01:00
parent 8c962e5c99
commit de326e5505

View file

@ -186,15 +186,15 @@ describe 'Auth concern', type: :controller do
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)
@ -203,7 +203,6 @@ describe 'Auth concern', type: :controller do
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)