Commit 33a8dfd0 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Make sessions controller specs more explicit

parent 00da609c
...@@ -69,7 +69,7 @@ describe SessionsController do ...@@ -69,7 +69,7 @@ describe SessionsController do
end end
end end
context ' when OTP is invalid' do context 'when OTP is invalid' do
before { authenticate_2fa(otp_attempt: 'invalid') } before { authenticate_2fa(otp_attempt: 'invalid') }
it 'does not authenticate' do it 'does not authenticate' do
...@@ -77,8 +77,8 @@ describe SessionsController do ...@@ -77,8 +77,8 @@ describe SessionsController do
end end
it 'warns about invalid OTP code' do it 'warns about invalid OTP code' do
expect(response).to set_flash expect(response).to set_flash.now[:alert]
.now[:alert].to /Invalid two-factor code/ .to /Invalid two-factor code/
end end
end end
end end
...@@ -90,7 +90,8 @@ describe SessionsController do ...@@ -90,7 +90,8 @@ describe SessionsController do
authenticate_2fa(login: another_user.username, authenticate_2fa(login: another_user.username,
otp_attempt: 'invalid') otp_attempt: 'invalid')
expect(response).to_not set_flash.now[:alert].to /Invalid login or password/ expect(response).to set_flash.now[:alert]
.to /Invalid two-factor code/
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment