FIX: deactivated users shouldn't be able to log in

This commit is contained in:
Neil Lalonde
2014-04-28 13:46:28 -04:00
parent 9fba385172
commit 1da59e7e2e
5 changed files with 20 additions and 4 deletions

View File

@ -195,6 +195,14 @@ describe SessionController do
end
end
describe 'deactivated user' do
it 'should return an error' do
User.any_instance.stubs(:active).returns(false)
xhr :post, :create, login: user.username, password: 'myawesomepassword'
expect(JSON.parse(response.body)['error']).to eq(I18n.t('login.not_activated'))
end
end
describe 'success by username' do
it 'logs in correctly' do
xhr :post, :create, login: user.username, password: 'myawesomepassword'