Show a useful message when a banned user tries to log in
This commit is contained in:
parent
948fc62b4a
commit
5d6ad8f39c
3 changed files with 17 additions and 0 deletions
spec/controllers
|
@ -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'
|
||||
|
|
Reference in a new issue