Fixing issue with auto-creation of new contact user for enterprises caused by delayed-job

This commit is contained in:
Rob Harrington
2015-06-11 15:25:18 +08:00
parent 1c1f82f4ee
commit 1cd6866879
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -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')