|
|
@ -412,6 +412,17 @@ RSpec.describe CaseLog do |
|
|
|
.to raise_error(ActiveRecord::RecordInvalid, /#{I18n.t("validations.postcode")}/) |
|
|
|
.to raise_error(ActiveRecord::RecordInvalid, /#{I18n.t("validations.postcode")}/) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when the local authority lookup times out" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(Timeout).to receive(:timeout).and_raise(Timeout::Error) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "logs a warning" do |
|
|
|
|
|
|
|
expect(Rails.logger).to receive(:warn).with("Postcodes.io lookup timed out") |
|
|
|
|
|
|
|
address_case_log.update!({ postcode_known: 1, property_postcode: "M1 1AD" }) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "correctly resets all fields if property postcode not known" do |
|
|
|
it "correctly resets all fields if property postcode not known" do |
|
|
|
address_case_log.update!({ postcode_known: 0 }) |
|
|
|
address_case_log.update!({ postcode_known: 0 }) |
|
|
|
|
|
|
|
|
|
|
|