diff options
| author | mo khan <mo@mokhan.ca> | 2014-09-18 10:11:14 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-09-18 10:11:14 -0600 |
| commit | 47181c1901d1cbc2afc974ed60f4730a5468600c (patch) | |
| tree | 99b9c781f23650239aa167bbae141257805c1b37 /spec | |
| parent | 3f346fd2b4b226a013e6dc9d3b959cf1f3a66428 (diff) | |
add action to send reset password instructions.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/controllers/passwords_controller_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/passwords_controller_spec.rb b/spec/controllers/passwords_controller_spec.rb index c6e5121f..ab353d74 100644 --- a/spec/controllers/passwords_controller_spec.rb +++ b/spec/controllers/passwords_controller_spec.rb @@ -7,4 +7,18 @@ describe PasswordsController do expect(assigns(:user)).to be_new_record end end + + describe "#create" do + let(:email) { Faker::Internet.email } + + it "sends a password reset email for the user" do + allow(PasswordReset).to receive(:send_reset_instructions_to) + + post :create, user: { email: email } + + expect(PasswordReset).to have_received(:send_reset_instructions_to).with(email) + expect(response).to redirect_to(new_session_path) + expect(flash[:notice]).to_not be_empty + end + end end |
