<commit_before>require 'spec_helper'

feature "Account Settings", js: true do
  include AuthenticationWorkflow

  describe "as a logged in user" do
    let(:user) { create(:user, email: '<EMAIL>') }

    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')
      fill_in 'user_email', with: '<EMAIL>'

      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 '<EMAIL>'
      expect(user.unconfirmed_email).to eq '<EMAIL>'<commit_msg>Update account setting spec for updating email address<commit_after>require 'spec_helper'

feature "Account Settings", js: true do
  include AuthenticationWorkflow

  describe "as a logged in user" do
    let(:user) { create(:user, email: '<EMAIL>') }

    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')
      fill_in 'user_email', with: '<EMAIL>'

      expect do
        click_button I18n.t(:update)
      end.to send_confirmation_instructions

      sent_mail = ActionMailer::Base.deliveries.last
      expect(sent_mail.to).to eq ['<EMAIL>']

      expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×"
      user.reload
      expect(user.email).to eq '<EMAIL>'
      expect(user.unconfirmed_email).to eq '<EMAIL>'
{'fraction_non_alphanumeric': 0.12684031710079274, 'fraction_numerical': 0.009060022650056626, 'mean_word_length': 3.352216748768473, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2882804', 'n_tokens_mistral': 584, 'n_tokens_neox': 558, 'n_words': 135}