|
45 | 45 | it "sends user email" do |
46 | 46 | fill_in "Email", with: user.email |
47 | 47 |
|
48 | | - expect { click_on "Send me reset password instructions" }.to change { ActionMailer::Base.deliveries.count }.by(1) |
49 | | - expect(ActionMailer::Base.deliveries.last.to_addresses.map(&:address)).to include user.email |
| 48 | + click_on "Send me reset password instructions" |
| 49 | + |
| 50 | + expect(page).to have_content "If the account exists you will receive an email or SMS with instructions on how to reset your password in a few minutes." |
| 51 | + |
| 52 | + expect(ActionMailer::Base.deliveries.count).to eq(1) |
| 53 | + expect(ActionMailer::Base.deliveries.last.to).to eq([user.email]) |
50 | 54 | end |
51 | 55 |
|
52 | 56 | it "has reset password url with token" do |
53 | 57 | fill_in "Email", with: user.email |
54 | 58 | click_on "Send me reset password instructions" |
55 | 59 |
|
| 60 | + expect(page).to have_content "If the account exists you will receive an email or SMS with instructions on how to reset your password in a few minutes." |
56 | 61 | expect(reset_password_link(user.email)).to match(/http:\/\/localhost:3000\/users\/password\/edit\?reset_password_token=.*/) |
57 | 62 | end |
58 | 63 |
|
59 | 64 | it "url token matches user's encrypted token" do |
60 | 65 | fill_in "Email", with: user.email |
61 | 66 | click_on "Send me reset password instructions" |
62 | 67 |
|
| 68 | + expect(page).to have_content "If the account exists you will receive an email or SMS with instructions on how to reset your password in a few minutes." |
| 69 | + |
63 | 70 | token = reset_password_link(user.email).gsub("http://localhost:3000/users/password/edit?reset_password_token=", "") |
64 | 71 | encrypted_token = Devise.token_generator.digest(User, :reset_password_token, token) |
65 | 72 | expect(User.find_by(reset_password_token: encrypted_token)).not_to be_nil |
|
80 | 87 | click_on "Log In" |
81 | 88 |
|
82 | 89 | expect(page).to have_text(user.display_name) |
| 90 | + expect(page).to have_text("My Cases") |
83 | 91 | expect(page).not_to have_text("Sign in") |
84 | 92 | end |
85 | 93 | end |
|
0 commit comments