Display error on email (triggered by advance_order_state method)

This commit is contained in:
Jean-Baptiste Bellet
2021-08-27 13:55:51 +02:00
parent 69ec17ef92
commit a1438f91e9
3 changed files with 4 additions and 4 deletions

View File

@@ -37,9 +37,9 @@ class SplitCheckoutController < ::BaseController
load_shipping_method
handle_shipping_method_selection
if confirm_order || update_order
confirm_or_update = confirm_order || update_order
if confirm_or_update && advance_order_state
clear_invalid_payments
advance_order_state
redirect_to_step
else
if @shipping_method_id.blank?

View File

@@ -501,7 +501,7 @@ module Spree
def disallow_guest_order
return unless using_guest_checkout? && registered_email?
errors.add(:base, I18n.t('devise.failure.already_registered'))
errors.add(:email, I18n.t('devise.failure.already_registered'))
end
# After changing line items of a completed order

View File

@@ -1059,7 +1059,7 @@ describe Spree::Order do
it "returns a validation error" do
expect{ order.next }.to change(order.errors, :count).from(0).to(1)
expect(order.errors.messages[:base]).to eq [I18n.t('devise.failure.already_registered')]
expect(order.errors.messages[:email]).to eq [I18n.t('devise.failure.already_registered')]
expect(order.state).to eq 'cart'
end
end