Show a useful message when a banned user tries to log in

This commit is contained in:
Neil Lalonde
2013-06-27 15:14:42 -04:00
parent 948fc62b4a
commit 5d6ad8f39c
3 changed files with 17 additions and 0 deletions

View File

@ -23,6 +23,15 @@ describe SessionController do
end
end
describe 'banned user' do
it 'should return an error' do
User.any_instance.stubs(:is_banned?).returns(true)
User.any_instance.stubs(:banned_till).returns(2.days.from_now)
xhr :post, :create, login: user.username, password: 'myawesomepassword'
::JSON.parse(response.body)['error'].should be_present
end
end
describe 'success by username' do
before do
xhr :post, :create, login: user.username, password: 'myawesomepassword'