Commit f7e9cb53

mo khan <mo@mokhan.ca>
2014-09-18 18:02:57
add spec to login after resetting a password.
1 parent 2d2741e
Changed files (1)
spec/features/forgot_password_spec.rb
@@ -17,4 +17,20 @@ describe "password retrieval", :js => true do
       page.should have_content(I18n.t('devise.passwords.send_instructions'))
     end
   end
+
+  context "when a password is reset" do
+    let(:user) { create(:user, reset_password_token: SecureRandom.hex(32)) }
+
+    it "lets them log in with the new password" do
+      visit edit_password_path(user.reset_password_token)
+      fill_in "user_password", with: 'donkey'
+      click_button "Change my password"
+      within('.form-inline') do
+        fill_in('session_username', with: user.email)
+        fill_in('session_password', with: "donkey")
+      end
+      click_button("Sign In")
+      expect(page).to have_content("Log Out")
+    end
+  end
 end