Files
openfoodnetwork/spec/features/consumer/account/settings_spec.rb
2018-02-07 10:41:53 +11:00

31 lines
946 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
require 'spec_helper'
feature "Account Settings", js: true do
include AuthenticationWorkflow
describe "as a logged in user" do
let(:user) { create(:user, email: 'old@email.com') }
before do
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')
fill_in 'user_email', with: 'new@email.com'
click_button I18n.t(:update)
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×"
user.reload
expect(user.email).to eq 'old@email.com'
expect(user.unconfirmed_email).to eq 'new@email.com'
click_link I18n.t('spree.users.show.tabs.settings')
expect(page).to have_content I18n.t('spree.users.show.unconfirmed_email', unconfirmed_email: 'new@email.com')
end
end
end