|
|
@ -156,6 +156,7 @@ RSpec.describe Validations::PropertyValidations do |
|
|
|
record.rent_type = 2 |
|
|
|
record.rent_type = 2 |
|
|
|
property_validator.validate_la(record) |
|
|
|
property_validator.validate_la(record) |
|
|
|
expect(record.errors["la"]).to include(match(expected_error)) |
|
|
|
expect(record.errors["la"]).to include(match(expected_error)) |
|
|
|
|
|
|
|
expect(record.errors["property_postcode"]).to be_empty |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "expects that the local authority is in London" do |
|
|
|
it "expects that the local authority is in London" do |
|
|
@ -164,6 +165,17 @@ RSpec.describe Validations::PropertyValidations do |
|
|
|
property_validator.validate_la(record) |
|
|
|
property_validator.validate_la(record) |
|
|
|
expect(record.errors["la"]).to be_empty |
|
|
|
expect(record.errors["la"]).to be_empty |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when the la has been derived from a known postcode" do |
|
|
|
|
|
|
|
it "also adds an error to the postcode field" do |
|
|
|
|
|
|
|
record.la = "E07000105" |
|
|
|
|
|
|
|
record.rent_type = 2 |
|
|
|
|
|
|
|
record.postcode_known = 1 |
|
|
|
|
|
|
|
record.property_postcode = "BN18 7TR" |
|
|
|
|
|
|
|
property_validator.validate_la(record) |
|
|
|
|
|
|
|
expect(record.errors["property_postcode"]).to include(match(expected_error)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when previous la is known" do |
|
|
|
context "when previous la is known" do |
|
|
|