From 1343e2c8080ad6577bc0a33a23c562a06dcc2f8d Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Fri, 29 Jul 2022 08:45:40 +0100 Subject: [PATCH] Reference translation file in spec --- spec/models/location_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/location_spec.rb b/spec/models/location_spec.rb index 9cebd09ef..764a780d6 100644 --- a/spec/models/location_spec.rb +++ b/spec/models/location_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Location, type: :model do it "does add an error when the postcode is invalid" do location.postcode = "invalid" expect { location.save! } - .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Postcode Enter a postcode in the correct format, for example AA1 1AA") + .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Postcode #{I18n.t('validations.postcode')}") end end @@ -42,7 +42,7 @@ RSpec.describe Location, type: :model do it "does add an error when the postcode is invalid" do location.units = nil expect { location.save! } - .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Units Enter total number of units at this location") + .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Units #{I18n.t('activerecord.errors.models.location.attributes.units.blank')}") end end @@ -52,7 +52,7 @@ RSpec.describe Location, type: :model do it "does add an error when the postcode is invalid" do location.type_of_unit = nil expect { location.save! } - .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Type of unit Select the most common type of unit at this location") + .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Type of unit #{I18n.t('activerecord.errors.models.location.attributes.type_of_unit.blank')}") end end