Browse Source

checking raising error

pull/704/head
JG 3 years ago
parent
commit
c2b3a1cd40
  1. 5
      spec/models/location_spec.rb

5
spec/models/location_spec.rb

@ -20,9 +20,8 @@ RSpec.describe Location, type: :model do
it "does add an error when the postcode is invalid" do it "does add an error when the postcode is invalid" do
location.postcode = "invalid" location.postcode = "invalid"
location.save! expect { location.save! }
expect(location.errors).not_to be_empty .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Postcode Enter a postcode in the correct format, for example AA1 1AA")
expect(location.errors["postcode"]).to include(match I18n.t("validations.postcode"))
end end
end end
end end

Loading…
Cancel
Save