-
-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e39f3e
commit 55411af
Showing
1 changed file
with
22 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,22 @@ | |
include AuthenticationWorkflow | ||
|
||
describe "as a logged in user" do | ||
let(:user) { create(:user, email: '[email protected]') } | ||
let(:user) do | ||
create(:user, | ||
email: '[email protected]', | ||
password: 'OriginalPassword', | ||
password_confirmation: 'OriginalPassword') | ||
end | ||
|
||
before do | ||
create(:mail_method) | ||
quick_login_as user | ||
end | ||
|
||
it "allows me to update my account details" do | ||
visit "/account" | ||
|
||
click_link I18n.t('spree.users.show.tabs.settings') | ||
expect(page).to have_content I18n.t('spree.users.form.account_settings') | ||
end | ||
|
||
it "allows the user to update their email address" do | ||
fill_in 'user_email', with: '[email protected]' | ||
|
||
click_button I18n.t(:update) | ||
|
@@ -27,5 +31,18 @@ | |
click_link I18n.t('spree.users.show.tabs.settings') | ||
expect(page).to have_content I18n.t('spree.users.show.unconfirmed_email', unconfirmed_email: '[email protected]') | ||
end | ||
|
||
it "allows the user to change their password" do | ||
allow(Spree::Auth::Config).to receive(:[]).with(:signout_after_password_change).and_return(false) | ||
initial_password = user.encrypted_password | ||
|
||
fill_in 'user_password', with: 'NewPassword' | ||
fill_in 'user_password_confirmation', with: 'NewPassword' | ||
|
||
click_button I18n.t(:update) | ||
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×" | ||
|
||
expect(user.reload.encrypted_password).to_not eq initial_password | ||
end | ||
end | ||
end |