-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from jacobherrington/remove-error-flashing-fr…
…om-login Remove flash errors from password recovery
- Loading branch information
Showing
4 changed files
with
25 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,19 +7,31 @@ | |
ActionMailer::Base.default_url_options[:host] = 'http://example.com' | ||
end | ||
|
||
scenario 'allow a user to supply an email for the password reset' do | ||
create(:user, email: '[email protected]', password: 'secret', password_confirmation: 'secret') | ||
visit spree.login_path | ||
click_link 'Forgot Password?' | ||
fill_in 'Email', with: '[email protected]' | ||
click_button 'Reset my password' | ||
expect(page).to have_text 'You will receive an email with instructions' | ||
context 'when an account with this email address exists' do | ||
let!(:user) { create(:user, email: '[email protected]', password: 'secret', password_confirmation: 'secret') } | ||
|
||
scenario 'allows a user to supply an email for the password reset' do | ||
visit spree.login_path | ||
click_link 'Forgot Password?' | ||
fill_in_email | ||
click_button 'Reset my password' | ||
expect(page).to have_text 'you will receive an email with instructions' | ||
end | ||
end | ||
|
||
scenario 'shows errors if no email is supplied' do | ||
# Test that we are extending the functionality from | ||
# https://github.com/solidusio/solidus_auth_devise/pull/155 | ||
# to the non-admin login | ||
scenario 'does not reveal email addresses if they are not found' do | ||
visit spree.login_path | ||
click_link 'Forgot Password?' | ||
fill_in_email | ||
click_button 'Reset my password' | ||
expect(page).to have_text "Email can't be blank" | ||
expect(page).to_not have_text "Email not found" | ||
expect(page).to have_text 'you will receive an email with instructions' | ||
end | ||
|
||
def fill_in_email | ||
fill_in 'Email', with: '[email protected]' | ||
end | ||
end |