diff options
| author | mo khan <mo@mokhan.ca> | 2013-07-20 08:11:56 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-07-20 08:11:56 -0600 |
| commit | 8f0ee9adeb7d472e25bd3e747c9e2134a73fee06 (patch) | |
| tree | ee28df039ba44adcdf0728a6867072f5c4e2c70a /spec/features | |
| parent | 5b21deb085597e5062970587e23d207613a1746b (diff) | |
create feature tests for logging in
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/logins_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/features/logins_spec.rb b/spec/features/logins_spec.rb index 8e2dd50d..12227331 100644 --- a/spec/features/logins_spec.rb +++ b/spec/features/logins_spec.rb @@ -2,9 +2,30 @@ require 'spec_helper' describe "Logins" do describe "GET /logins" do - it "works! (now write some real specs)" do + it "should be able to reach the login page" do visit '/login' page.should have_content("Got an account? Login!") end + + context "when an email is registered", :js => true do + let!(:user) { create(:user, :password => "password") } + + before :each do + visit '/login' + within('.form-inline') do + fill_in('user_email', :with => user.email) + fill_in('user_password', :with => "password") + end + click_button("Sign In") + end + + it "should let the user signin with the proper password" do + page.should have_content(I18n.t('devise.sessions.signed_in')) + end + + it "should not have an error" do + page.should_not have_content(I18n.t('devise.failure.invalid')) + end + end end end |
