8_increase_test_coverage_controllers #36
1 changed files with 2 additions and 3 deletions
|
@ -186,15 +186,15 @@ describe 'Auth concern', type: :controller do
|
||||||
let(:token_msg) { token_verifier.generate }
|
let(:token_msg) { token_verifier.generate }
|
||||||
let(:user) { create :user }
|
let(:user) { create :user }
|
||||||
|
|
||||||
|
before { login user }
|
||||||
|
|
||||||
it 'authenticates token' do
|
it 'authenticates token' do
|
||||||
login user
|
|
||||||
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
||||||
get_with_defaults :try_authenticate_or_token, params: { token: token_msg }
|
get_with_defaults :try_authenticate_or_token, params: { token: token_msg }
|
||||||
expect(response).not_to have_http_status(:redirect)
|
expect(response).not_to have_http_status(:redirect)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects on faulty token' do
|
it 'redirects on faulty token' do
|
||||||
login user
|
|
||||||
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
||||||
get_with_defaults :try_authenticate_or_token, params: { token: 'abc' }
|
get_with_defaults :try_authenticate_or_token, params: { token: 'abc' }
|
||||||
expect(response).to have_http_status(:redirect)
|
expect(response).to have_http_status(:redirect)
|
||||||
|
@ -203,7 +203,6 @@ describe 'Auth concern', type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'authenticates current user on empty token' do
|
it 'authenticates current user on empty token' do
|
||||||
login user
|
|
||||||
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
routes.draw { get 'try_authenticate_or_token' => 'dummy_auth#try_authenticate_or_token' }
|
||||||
get_with_defaults :try_authenticate_or_token
|
get_with_defaults :try_authenticate_or_token
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
|
|
Loading…
Reference in a new issue