diff --git a/app/controllers/enterprise_confirmations_controller.rb b/app/controllers/enterprise_confirmations_controller.rb index d275260599..0375a04d49 100644 --- a/app/controllers/enterprise_confirmations_controller.rb +++ b/app/controllers/enterprise_confirmations_controller.rb @@ -40,7 +40,7 @@ class EnterpriseConfirmationsController < DeviseController def new_user_reset_path(resource) password = Devise.friendly_token.first(8) user = Spree::User.create(email: resource.email, password: password, password_confirmation: password) - user.send_reset_password_instructions + user.send_reset_password_instructions_without_delay resource.users << user spree.edit_spree_user_password_path(user, :reset_password_token => user.reset_password_token, return_to: spree.admin_path) end diff --git a/spec/controllers/enterprise_confirmations_controller_spec.rb b/spec/controllers/enterprise_confirmations_controller_spec.rb index 6fdab61be2..49e7ffe6e1 100644 --- a/spec/controllers/enterprise_confirmations_controller_spec.rb +++ b/spec/controllers/enterprise_confirmations_controller_spec.rb @@ -50,6 +50,7 @@ describe EnterpriseConfirmationsController do end it "redirects to the user to reset their password" do + expect(new_user).to receive(:send_reset_password_instructions_without_delay).and_call_original spree_get :show, confirmation_token: unconfirmed_enterprise.confirmation_token expect(response).to redirect_to spree.edit_spree_user_password_path(new_user, :reset_password_token => "token", return_to: spree.admin_path) expect(flash[:success]).to eq I18n.t('devise.enterprise_confirmations.enterprise.confirmed')