Skip to content

Commit

Permalink
Update specs to match change in typography
Browse files Browse the repository at this point in the history
From the active_model changelog:

Improve typography of user facing error messages. In English contractions,
    the Unicode APOSTROPHE (`U+0027`) is now RIGHT SINGLE QUOTATION MARK
    (`U+2019`). For example, "can't be blank" is now "can’t be blank".

    *Jon Dufresne*
  • Loading branch information
peterberkenbosch committed Sep 1, 2023
1 parent 357b289 commit ea5b56a
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion api/spec/requests/spree/api/addresses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module Spree::Api

expect(json_response['error']).not_to be_nil
expect(json_response['errors']).not_to be_nil
expect(json_response['errors']['address1'].first).to eq "can't be blank"
expect(json_response['errors']['address1'].first).to eq "cant be blank"
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions api/spec/requests/spree/api/checkouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ module Spree::Api
put spree.api_checkout_path(order.to_param), params: { order_token: order.guest_token, order: { payments_attributes: [{ payment_method_id: @payment_method.id }] } }
expect(response.status).to eq(422)
source_errors = json_response['errors']['payments.source']
expect(source_errors).to include("can't be blank")
expect(source_errors).to include("cant be blank")
end

describe 'setting the payment amount' do
Expand Down Expand Up @@ -252,10 +252,10 @@ module Spree::Api

expect(response.status).to eq(422)
cc_errors = json_response['errors']['payments.Credit Card']
expect(cc_errors).to include("Card Number can't be blank")
expect(cc_errors).to include("Card Number cant be blank")
expect(cc_errors).to include("Month is not a number")
expect(cc_errors).to include("Year is not a number")
expect(cc_errors).to include("Verification Value can't be blank")
expect(cc_errors).to include("Verification Value cant be blank")
end
end

Expand Down
4 changes: 2 additions & 2 deletions api/spec/requests/spree/api/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ module Spree::Api

expect(json_response['error']).not_to be_nil
expect(json_response['errors']).not_to be_nil
expect(json_response['errors']['bill_address.city'].first).to eq "can't be blank"
expect(json_response['errors']['bill_address.city'].first).to eq "cant be blank"
end

it "can add shipping address" do
Expand All @@ -633,7 +633,7 @@ module Spree::Api

expect(json_response['error']).not_to be_nil
expect(json_response['errors']).not_to be_nil
expect(json_response['errors']['ship_address.city'].first).to eq "can't be blank"
expect(json_response['errors']['ship_address.city'].first).to eq "cant be blank"
end

it "cannot set the user_id for the order" do
Expand Down
2 changes: 1 addition & 1 deletion api/spec/requests/spree/api/payments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Spree::Api
post spree.api_order_payments_path(order), params: { payment: { payment_method_id: Spree::PaymentMethod.first.id, amount: 50 } }
expect(response.status).to eq(422)
expect(json_response['error']).to eq("Invalid resource. Please fix errors and try again.")
expect(json_response['errors']['source']).to eq(["can't be blank"])
expect(json_response['errors']['source']).to eq(["cant be blank"])
end
end

Expand Down
2 changes: 1 addition & 1 deletion api/spec/requests/spree/api/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ module Spree::Api
put spree.api_product_path(product), params: { product: { name: "" } }
expect(response.status).to eq(422)
expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.")
expect(json_response["errors"]["name"]).to eq(["can't be blank"])
expect(json_response["errors"]["name"]).to eq(["cant be blank"])
end

# Regression test for https://github.com/spree/spree/issues/4123
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<h2>2 errors prohibited this record from being saved:</h2>
<p>There were problems with the following fields:</p>
<ul>
<li>Email can't be blank</li>
<li>Password can't be blank</li>
<li>Email cant be blank</li>
<li>Password cant be blank</li>
</ul>
</div>

<div class="field withError half">
<span class="field_with_errors"><label for="user_name">Name</label></span>
<span class="field_with_errors"><input class="fullwidth" type="text" name="user[name]" id="user_name"></span>
<span class="formError">can't be blank</span>
<span class="formError">cant be blank</span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@

it "sets the flash error" do
subject
expect(flash[:error]).to eq "Name can't be blank"
expect(flash[:error]).to eq "Name cant be blank"
end

it "renders new" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
it "should display validation errors" do
fill_in "payment_method_name", with: ""
click_button "Update"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
end

context 'with payment method having hash and array as preference' do
Expand Down
2 changes: 1 addition & 1 deletion backend/spec/features/admin/configuration/store_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
fill_in "Site Name", with: " "
click_button "Update"

expect(page).to have_content("can't be blank")
expect(page).to have_content("cant be blank")
expect(page).to have_field("Site Name", with: " ")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

it "should show validation errors if there are any" do
click_button "Create"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
it "should display validation errors" do
fill_in "taxonomy_name", with: ""
click_button "Create"
expect(page).to have_content("can't be blank")
expect(page).to have_content("cant be blank")
end

it "disables the button at submit", :js do
Expand Down
4 changes: 2 additions & 2 deletions backend/spec/features/admin/orders/adjustments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
fill_in "adjustment_amount", with: ""
fill_in "adjustment_label", with: ""
click_button "Continue"
expect(page).to have_content("Label can't be blank")
expect(page).to have_content("Label cant be blank")
expect(page).to have_content("Amount is not a number")
end
end
Expand Down Expand Up @@ -105,7 +105,7 @@
fill_in "adjustment_amount", with: ""
fill_in "adjustment_label", with: ""
click_button "Continue"
expect(page).to have_content("Label can't be blank")
expect(page).to have_content("Label cant be blank")
expect(page).to have_content("Amount is not a number")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
order.update!(ship_address_id: nil)
click_link "Customer"
click_button "Update"
expect(page).to have_content("Shipping address name can't be blank")
expect(page).to have_content("Shipping address name cant be blank")
end

context "for an order in confirm state with a user" do
Expand Down
6 changes: 3 additions & 3 deletions backend/spec/features/admin/orders/payments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@
it "is unable to create a new payment with invalid information" do
click_button "Continue"
expect(page).to have_content("Payment could not be created.")
expect(page).to have_content("Number can't be blank")
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Verification Value can't be blank")
expect(page).to have_content("Number cant be blank")
expect(page).to have_content("Name cant be blank")
expect(page).to have_content("Verification Value cant be blank")
expect(page).to have_content("Month is not a number")
expect(page).to have_content("Year is not a number")
end
Expand Down
2 changes: 1 addition & 1 deletion backend/spec/features/admin/products/edit/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

fill_in "product_slug", with: ''
click_button "Update"
within('#product_slug_field') { expect(page).to have_content("can't be blank") }
within('#product_slug_field') { expect(page).to have_content("cant be blank") }

fill_in "product_slug", with: 'x'
click_button "Update"
Expand Down
4 changes: 2 additions & 2 deletions backend/spec/features/admin/products/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def build_option_type_with_values(name, values)
fill_in "product_sku", with: "B100"
fill_in "product_price", with: "100"
click_button "Create"
expect(page).to have_content("Shipping category can't be blank")
expect(page).to have_content("Shipping category cant be blank")
end

context "using a locale with a different decimal format " do
Expand Down Expand Up @@ -251,7 +251,7 @@ def build_option_type_with_values(name, values)
select @shipping_category.name, from: "product_shipping_category_id"
fill_in "product_price", with: "19,99"
click_button "Create"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
expect(page).to have_field('product_price', with: '19,99')
end
end
Expand Down
2 changes: 1 addition & 1 deletion backend/spec/features/admin/products/properties_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
it "should show validation errors" do
fill_in "property_name", with: ""
click_button "Update"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
fill_in "promotion_category_name", with: ""
fill_in "promotion_category_code", with: "prtest"
click_button "Create"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
end
end

Expand All @@ -65,7 +65,7 @@
it "should show validation errors" do
fill_in "promotion_category_name", with: ""
click_button "Update"
expect(page).to have_content("Name can't be blank")
expect(page).to have_content("Name cant be blank")
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/spec/lib/calculated_adjustments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Calculable < ActiveRecord::Base

it 'is not valid' do
expect(subject).not_to be_valid
expect(subject.errors[:calculator]).to eq ["can't be blank"]
expect(subject.errors[:calculator]).to eq ["cant be blank"]
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/address/state_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

subject

expect(address.errors.messages).to eq({ state: ["can't be blank"] })
expect(address.errors.messages).to eq({ state: ["cant be blank"] })
end

context "state country doesn't match the address' country" do
Expand Down
6 changes: 3 additions & 3 deletions core/spec/models/spree/address_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
address.state = nil
address.state_name = nil
expect(address.valid?).to eq(false)
expect(address.errors['state']).to eq(["can't be blank"])
expect(address.errors['state']).to eq(["cant be blank"])
end
end

it "requires phone" do
address.phone = ""
address.valid?
expect(address.errors["phone"]).to eq(["can't be blank"])
expect(address.errors["phone"]).to eq(["cant be blank"])
end

it "requires zipcode" do
address.zipcode = ""
address.valid?
expect(address.errors['zipcode']).to include("can't be blank")
expect(address.errors['zipcode']).to include("cant be blank")
end

context "phone not required" do
Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/adjustment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
context "when the promotion has a code" do
let!(:promotion_code) { create(:promotion_code, promotion: promotion) }

it { is_expected.to include("can't be blank") }
it { is_expected.to include("cant be blank") }
end
end

Expand Down
4 changes: 2 additions & 2 deletions core/spec/models/spree/credit_card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def self.payment_states
it "should validate presence of number" do
credit_card.attributes = valid_credit_card_attributes.except(:number)
expect(credit_card).not_to be_valid
expect(credit_card.errors[:number]).to eq(["can't be blank"])
expect(credit_card.errors[:number]).to eq(["cant be blank"])
end

it "should validate presence of security code" do
credit_card.attributes = valid_credit_card_attributes.except(:verification_value)
expect(credit_card).not_to be_valid
expect(credit_card.errors[:verification_value]).to eq(["can't be blank"])
expect(credit_card.errors[:verification_value]).to eq(["cant be blank"])
end

it "validates name presence" do
Expand Down
4 changes: 2 additions & 2 deletions core/spec/models/spree/fulfilment_changer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@

it "has an activemodel error hash" do
subject
expect(shipment_splitter.errors.messages).to eq(desired_stock_location: ["can't be blank"])
expect(shipment_splitter.errors.messages).to eq(desired_stock_location: ["cant be blank"])
end
end

Expand Down Expand Up @@ -434,7 +434,7 @@

it "has an activemodel error hash" do
subject
expect(shipment_splitter.errors.messages).to eq(desired_stock_location: ["can't be blank"])
expect(shipment_splitter.errors.messages).to eq(desired_stock_location: ["cant be blank"])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/order/validations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Spree
order = Spree::Order.new
allow(order).to receive_messages(email_required?: true)
order.valid?
expect(order.errors[:email]).to eq(["can't be blank"])
expect(order.errors[:email]).to eq(["cant be blank"])
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/spec/models/spree/order_promotion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
promotion.codes << build(:promotion_code, promotion: promotion)
end

it { is_expected.to include("can't be blank") }
it { is_expected.to include("cant be blank") }
end
end

Expand Down
4 changes: 2 additions & 2 deletions core/spec/models/spree/payment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@
payment.source = Spree::CreditCard.new
expect(payment).not_to be_valid
cc_errors = payment.errors['Credit Card']
expect(cc_errors).to include("Card Number can't be blank")
expect(cc_errors).to include("Card Number cant be blank")
expect(cc_errors).to include("Month is not a number")
expect(cc_errors).to include("Year is not a number")
expect(cc_errors).to include("Verification Value can't be blank")
expect(cc_errors).to include("Verification Value cant be blank")
end
end

Expand Down
4 changes: 2 additions & 2 deletions core/spec/models/spree/store_credit_event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

it "adds an error message indicating the store credit reason is missing" do
subject
expect(event.errors.full_messages).to match ["Store credit reason can't be blank"]
expect(event.errors.full_messages).to match ["Store credit reason cant be blank"]
end
end
end
Expand All @@ -78,7 +78,7 @@

it "adds an error message indicating the store credit reason is missing" do
subject
expect(event.errors.full_messages).to match ["Store credit reason can't be blank"]
expect(event.errors.full_messages).to match ["Store credit reason cant be blank"]
end
end
end
Expand Down

0 comments on commit ea5b56a

Please sign in to comment.