|
17 | 17 | click_button "Send reset instructions" |
18 | 18 |
|
19 | 19 | expect(page) |
20 | | - .to have_content("You will receive an email with instructions on how to reset your password in a few minutes.") |
| 20 | + .to have_content("If your email address exists in our database, you will receive a password recovery link") |
21 | 21 | end |
22 | 22 |
|
23 | | - it "Displays error if email not found." do |
24 | | - visit admin_new_password_path |
| 23 | + context "with paranoid mode disabled" do |
| 24 | + before do |
| 25 | + allow(Devise).to receive(:paranoid).and_return(false) |
| 26 | + end |
25 | 27 |
|
26 | | - fill_in :user_email, with: "wrong@email.com" |
27 | | - click_button "Send reset instructions" |
| 28 | + it "Displays error if email not found." do |
| 29 | + visit admin_new_password_path |
| 30 | + |
| 31 | + fill_in :user_email, with: "wrong@email.com" |
| 32 | + click_button "Send reset instructions" |
| 33 | + |
| 34 | + expect(page).to have_content("Email not found") |
| 35 | + end |
| 36 | + end |
| 37 | + |
| 38 | + context "with paranoid mode enabled" do |
| 39 | + before do |
| 40 | + allow(Devise).to receive(:paranoid).and_return(true) |
| 41 | + end |
| 42 | + |
| 43 | + it "Displays notification about reset instructions.", :js do |
| 44 | + visit admin_new_password_path |
| 45 | + |
| 46 | + fill_in :user_email, with: "wrong@email.com" |
| 47 | + click_button "Send reset instructions" |
28 | 48 |
|
29 | | - expect(page).to have_content("Email not found") |
| 49 | + expect(page).to have_content( |
| 50 | + "If your email address exists in our database, you will receive a password recovery link" |
| 51 | + ) |
| 52 | + end |
30 | 53 | end |
31 | 54 |
|
32 | 55 | it "User can visit edit password form." do |
|
0 commit comments