|
|
|
@ -875,6 +875,34 @@ RSpec.describe Imports::LettingsLogsImportService do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and no scheme locations are confirmed" do |
|
|
|
|
let(:lettings_log_id) { "0b4a68df-30cc-474a-93c0-a56ce8fdad3b" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
scheme = Scheme.find_by(old_visible_id: "0123") |
|
|
|
|
scheme.locations.update!(confirmed: false, mobility_type: nil) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "intercepts the relevant validation error" do |
|
|
|
|
expect(logger).to receive(:warn).with(/Differences found when saving log/) |
|
|
|
|
expect(logger).to receive(:warn).with(/Removing scheme_id with error: This scheme cannot be chosen as it has no completed locations/) |
|
|
|
|
expect(logger).to receive(:warn).with(/Removing location_id with error: This scheme cannot be chosen as it has no completed locations/) |
|
|
|
|
expect { lettings_log_service.send(:create_log, lettings_log_xml) } |
|
|
|
|
.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "clears out the location answers" do |
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
lettings_log_service.send(:create_log, lettings_log_xml) |
|
|
|
|
lettings_log = LettingsLog.find_by(old_id: lettings_log_id) |
|
|
|
|
|
|
|
|
|
expect(lettings_log).not_to be_nil |
|
|
|
|
expect(lettings_log.location).to be_nil |
|
|
|
|
expect(lettings_log.scheme).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and carehome charges are out of range" do |
|
|
|
|
let(:lettings_log_id) { "0b4a68df-30cc-474a-93c0-a56ce8fdad3b" } |
|
|
|
|
|
|
|
|
|