mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Name order attributes similar to other text
Rails' auto-generated names used in error messages were a bit cryptic for users.
This commit is contained in:
@@ -26,6 +26,15 @@ en:
|
||||
spree/product: Product
|
||||
spree/shipping_method: Shipping Method
|
||||
attributes:
|
||||
spree/order/ship_address:
|
||||
address1: "Shipping address line 1"
|
||||
address2: "Shipping address line 2"
|
||||
city: "Shipping address suburb 1"
|
||||
country: "Shipping address country"
|
||||
phone: "Phone number"
|
||||
firstname: "First name"
|
||||
lastname: "Last name"
|
||||
zipcode: "Shipping address postcode"
|
||||
spree/user:
|
||||
password: "Password"
|
||||
password_confirmation: "Password confirmation"
|
||||
@@ -1996,7 +2005,6 @@ en:
|
||||
submit: Complete order
|
||||
cancel: Back to Payment method
|
||||
errors:
|
||||
global: "Saving failed, please update the highlighted fields."
|
||||
saving_failed: "Saving failed, please update the highlighted fields. %{messages}"
|
||||
terms_not_accepted: Please accept Terms and Conditions
|
||||
required: Field cannot be blank
|
||||
|
||||
@@ -86,7 +86,7 @@ describe SplitCheckoutController, type: :controller do
|
||||
put :update, params: params
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(flash[:error]).to eq "Saving failed, please update the highlighted fields."
|
||||
expect(flash[:error]).to match "Saving failed, please update the highlighted fields."
|
||||
expect(order.reload.state).to eq "cart"
|
||||
end
|
||||
end
|
||||
@@ -161,7 +161,7 @@ describe SplitCheckoutController, type: :controller do
|
||||
put :update, params: params
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(flash[:error]).to eq "Saving failed, please update the highlighted fields."
|
||||
expect(flash[:error]).to match "Saving failed, please update the highlighted fields."
|
||||
expect(order.reload.state).to eq "payment"
|
||||
end
|
||||
end
|
||||
@@ -271,7 +271,7 @@ describe SplitCheckoutController, type: :controller do
|
||||
put :update, params: params
|
||||
|
||||
expect(response.status).to eq 422
|
||||
expect(flash[:error]).to eq "Saving failed, please update the highlighted fields."
|
||||
expect(flash[:error]).to match "Saving failed, please update the highlighted fields."
|
||||
expect(order.reload.state).to eq "confirmation"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,6 +8,14 @@ describe Spree::Order do
|
||||
let(:user) { build(:user, email: "spree@example.com") }
|
||||
let(:order) { build(:order, user: user) }
|
||||
|
||||
describe "#errors" do
|
||||
it "provides friendly error messages" do
|
||||
order.ship_address = Spree::Address.new
|
||||
order.save
|
||||
expect(order.errors.full_messages).to include "Shipping address line 1 can't be blank"
|
||||
end
|
||||
end
|
||||
|
||||
context "#products" do
|
||||
let(:order) { create(:order_with_line_items) }
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ describe "As a consumer, I want to checkout my order" do
|
||||
click_button "Next - Payment method"
|
||||
|
||||
expect(page).to have_content "Saving failed, please update the highlighted fields."
|
||||
expect(page).to have_content "Ship address address1 can't be blank"
|
||||
expect(page).to have_content "Shipping address line 1 can't be blank"
|
||||
expect(page).to have_content "Shipping address same as billing address?"
|
||||
expect(page).to have_content "Save as default shipping address"
|
||||
expect(page).to have_checked_field "Shipping address same as billing address?"
|
||||
|
||||
Reference in New Issue
Block a user