mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-03 06:59:14 +00:00
Fixing issue with auto-creation of new contact user for enterprises caused by delayed-job
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user