From 4cb31d04a783140bc7573bdaa1f8066ce62aea2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Turbelin?= Date: Fri, 4 Feb 2022 10:03:07 +0100 Subject: [PATCH] Repair specs with default values on ensure_customer method --- app/models/spree/order.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 5380a273d4..a56028a614 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -717,16 +717,15 @@ module Spree def ensure_customer return if associate_customer - self.customer = Customer.new( + self.customer = Customer.create( enterprise: distributor, email: email_for_customer, user: user, - first_name: bill_address&.first_name, - last_name: bill_address&.last_name, + first_name: bill_address&.first_name.to_s, + last_name: bill_address&.last_name.to_s, bill_address: bill_address&.clone, ship_address: ship_address&.clone ) - customer.save Bugsnag.notify(customer.errors.full_messages.join(", ")) unless customer.persisted? end