From 88607a3dceb06cd900cf3484f506a8b83e1ba276 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 14 Feb 2023 09:44:50 +0100 Subject: [PATCH] Improve bill address error message "(Street + House number)" instead of "address1" and "postcode" instead of "zipcode" --- config/locales/en.yml | 2 ++ spec/models/spree/order_spec.rb | 6 ++++++ spec/system/consumer/split_checkout_spec.rb | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 33ae55daef..84158b1d46 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -36,6 +36,8 @@ en: lastname: "Last name" zipcode: "Shipping address postcode" spree/order/bill_address: + address1: "Bill address (Street + House number)" + zipcode: "Bill address postcode" phone: Customer phone spree/user: password: "Password" diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 8c1adba511..e42a7616c6 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -14,6 +14,12 @@ describe Spree::Order do order.save expect(order.errors.full_messages).to include "Shipping address line 1 can't be blank" end + + it "provides friendly error messages for bill address" do + order.bill_address = Spree::Address.new + order.save + expect(order.errors.full_messages).to include "Bill address (Street + House number) can't be blank" + end end context "#products" do diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index 299ffaceef..f595e64159 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -211,7 +211,7 @@ describe "As a consumer, I want to checkout my order" do end it "should display error message in the right order" do - expect(page).to have_content "Customer E-Mail can't be blank, Customer E-Mail is invalid, Customer phone can't be blank, Bill address firstname can't be blank, Bill address lastname can't be blank, Bill address address1 can't be blank, Bill address city can't be blank, Bill address zipcode can't be blank, and Shipping method Select a shipping method" + expect(page).to have_content "Customer E-Mail can't be blank, Customer E-Mail is invalid, Customer phone can't be blank, Bill address firstname can't be blank, Bill address lastname can't be blank, Bill address (Street + House number) can't be blank, Bill address city can't be blank, Bill address postcode can't be blank, and Shipping method Select a shipping method" end end end