mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Use activerecord error translations properly
This commit is contained in:
@@ -48,7 +48,7 @@ class StandingOrderConfirmJob
|
||||
result = payment_updater.new(@order).update!
|
||||
case result
|
||||
when :no_card
|
||||
@order.errors.add(:base, I18n.t("activerecord.errors.models.standing_order.no_card"))
|
||||
@order.errors.add(:base, :no_card)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -70,11 +70,11 @@ en:
|
||||
attributes:
|
||||
email:
|
||||
taken: "There's already an account for this email. Please login or reset your password."
|
||||
spree/order:
|
||||
no_card: There are no valid credit cards available
|
||||
activemodel:
|
||||
errors:
|
||||
models:
|
||||
standing_order:
|
||||
no_card: There are no valid credit cards available
|
||||
standing_order_form:
|
||||
attributes:
|
||||
standing_line_items:
|
||||
|
||||
@@ -124,7 +124,7 @@ describe StandingOrderConfirmJob do
|
||||
|
||||
it "adds and error to the order" do
|
||||
expect{ job.send(:update_payment!) }.to change(order.errors, :count).from(0).to(1)
|
||||
expect(order.errors.full_messages).to include I18n.t("activerecord.errors.models.standing_order.no_card")
|
||||
expect(order.errors.full_messages).to include I18n.t("activerecord.errors.models.spree/order.no_card")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user