From de326e550515bbcf4b5ce9dce430a26e692d7e8b Mon Sep 17 00:00:00 2001 From: Philipp Rothmann Date: Mon, 5 Dec 2022 17:23:44 +0100 Subject: [PATCH] refactor login user calls --- spec/controllers/concerns/auth_concern_spec.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/controllers/concerns/auth_concern_spec.rb b/spec/controllers/concerns/auth_concern_spec.rb index 2bdeb5e7..10bf8ec7 100644 --- a/spec/controllers/concerns/auth_concern_spec.rb +++ b/spec/controllers/concerns/auth_concern_spec.rb @@ -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)