mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Remove I18n keys in model specs
This commit is contained in:
@@ -136,14 +136,14 @@ describe Enterprise do
|
||||
it "prevents duplicate names for new records" do
|
||||
e = Enterprise.new name: enterprise.name
|
||||
expect(e).to_not be_valid
|
||||
expect(e.errors[:name].first).to include I18n.t('enterprise_name_error', email: owner.email)
|
||||
expect(e.errors[:name].first).to include enterprise_name_error(owner.email)
|
||||
end
|
||||
|
||||
it "prevents duplicate names for existing records" do
|
||||
e = create(:enterprise, name: 'foo')
|
||||
e.name = enterprise.name
|
||||
expect(e).to_not be_valid
|
||||
expect(e.errors[:name].first).to include I18n.t('enterprise_name_error', email: owner.email)
|
||||
expect(e.errors[:name].first).to include enterprise_name_error(owner.email)
|
||||
end
|
||||
|
||||
it "does not prohibit the saving of an enterprise with no name clash" do
|
||||
@@ -880,3 +880,10 @@ describe Enterprise do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def enterprise_name_error(owner_email)
|
||||
"has already been taken. \
|
||||
If this is your enterprise and you would like to claim ownership, \
|
||||
or if you would like to trade with this enterprise please contact \
|
||||
the current manager of this profile at %s." % owner_email
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ describe OrderBalance do
|
||||
end
|
||||
|
||||
it "returns 'balance due'" do
|
||||
expect(order_balance.label).to eq(I18n.t(:balance_due))
|
||||
expect(order_balance.label).to eq('Balance due')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ describe OrderBalance do
|
||||
end
|
||||
|
||||
it "returns 'credit owed'" do
|
||||
expect(order_balance.label).to eq(I18n.t(:credit_owed))
|
||||
expect(order_balance.label).to eq('Credit Owed')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ describe OrderBalance do
|
||||
end
|
||||
|
||||
it "returns 'balance due'" do
|
||||
expect(order_balance.label).to eq(I18n.t(:balance_due))
|
||||
expect(order_balance.label).to eq('Balance due')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -247,8 +247,8 @@ describe ProductImport::ProductImporter do
|
||||
# an unquoted \n will create a non valid line which will fail entry validation hence why we are only testing with \r
|
||||
it "should raise an unquoted field error if data include unquoted field with \r character" do
|
||||
expect(importer.errors.messages.values).to include(
|
||||
[I18n.t('admin.product_import.model.malformed_csv',
|
||||
error_message: "Unquoted fields do not allow new line <\"\\r\"> in line 3.")]
|
||||
[format("Product Import encountered a malformed CSV: %s",
|
||||
"Unquoted fields do not allow new line <\"\\r\"> in line 3.")]
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -490,7 +490,7 @@ describe ProductImport::ProductImporter do
|
||||
expect(filter('invalid', entries)).to eq 2
|
||||
|
||||
importer.entries.each do |entry|
|
||||
expect(entry.errors.messages.values).to include [I18n.t('admin.product_import.model.not_updatable')]
|
||||
expect(entry.errors.messages.values).to include ['cannot be updated on existing products via product import']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1044,7 +1044,7 @@ describe Spree::Order do
|
||||
|
||||
it "returns a validation error" do
|
||||
expect{ order.next }.to change(order.errors, :count).from(0).to(1)
|
||||
expect(order.errors.messages[:email]).to eq [I18n.t('devise.failure.already_registered')]
|
||||
expect(order.errors.messages[:email]).to eq ['This email address is already registered. Please log in to continue, or go back and use another email address.']
|
||||
expect(order.state).to eq 'cart'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -115,11 +115,11 @@ describe Spree::PaymentMethod do
|
||||
end
|
||||
|
||||
it "generates a clean name for known Payment Method types" do
|
||||
expect(Spree::PaymentMethod::Check.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.check"))
|
||||
expect(Spree::Gateway::PayPalExpress.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.paypalexpress"))
|
||||
expect(Spree::Gateway::StripeSCA.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.stripesca"))
|
||||
expect(Spree::Gateway::BogusSimple.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.bogussimple"))
|
||||
expect(Spree::Gateway::Bogus.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.bogus"))
|
||||
expect(Spree::PaymentMethod::Check.clean_name).to eq('Cash/EFT/etc. (payments for which automatic validation is not required)')
|
||||
expect(Spree::Gateway::PayPalExpress.clean_name).to eq('PayPal Express')
|
||||
expect(Spree::Gateway::StripeSCA.clean_name).to eq('Stripe SCA')
|
||||
expect(Spree::Gateway::BogusSimple.clean_name).to eq('BogusSimple')
|
||||
expect(Spree::Gateway::Bogus.clean_name).to eq('Bogus')
|
||||
end
|
||||
|
||||
it "computes the amount of fees" do
|
||||
|
||||
@@ -86,7 +86,7 @@ describe Spree::ReturnAuthorization do
|
||||
|
||||
expect(Spree::Adjustment).to receive(:create).with(
|
||||
amount: -20,
|
||||
label: I18n.t('spree.rma_credit'),
|
||||
label: 'RMA credit',
|
||||
order: order,
|
||||
adjustable: order,
|
||||
originator: return_authorization
|
||||
|
||||
Reference in New Issue
Block a user