Add Customer.full_name

This commit is contained in:
Adrien Chauve
2022-01-06 18:48:07 +01:00
committed by Maikel Linke
parent 5ca4d549e7
commit ba6523bb76
2 changed files with 5 additions and 1 deletions

View File

@@ -36,6 +36,10 @@ class Customer < ApplicationRecord
private
def full_name
"#{first_name} #{last_name}".strip
end
def downcase_email
email&.downcase!
end

View File

@@ -1054,7 +1054,7 @@ describe Spree::Order do
expect(order.customer).to be_nil
expect { order.send(:ensure_customer) }.to change{ Customer.count }.by 1
expect(order.customer.name).to eq order.bill_address.full_name
expect(order.customer.full_name).to eq order.bill_address.full_name
expect(order.customer.bill_address.same_as?(order.bill_address)).to be true
expect(order.customer.ship_address.same_as?(order.ship_address)).to be true
end