diff options
| author | mo khan <mo@mokhan.ca> | 2014-08-06 17:00:08 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-08-06 17:00:08 -0700 |
| commit | 04ffb1d896a0a778f1a2b4acdb6c14d9600a26f3 (patch) | |
| tree | 8be29ed959bf05f1a869d5db823f324dc8231218 /spec | |
| parent | faa3c68109767353a4631c5a0d074c351f6d8a40 (diff) | |
display error when the credentials are not known.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/sessions_controller_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 226dc27c..eaaaf3fe 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -23,5 +23,17 @@ describe SessionsController do expect(cookies.signed[:cookie_monster]).to eql(user_session.id) end end + + context "when the username is not known" do + before :each do + Session.stub(:login).and_return(nil) + end + + it "returns an error" do + post :create, session: { username: 'x', password: 'y' } + expect(response).to render_template(:new) + expect(flash[:error]).to_not be_empty + end + end end end |
