|
|
@ -323,6 +323,34 @@ RSpec.describe Imports::LettingsLogsImportService do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and is a other tenancy but missing tenancyother" do |
|
|
|
|
|
|
|
let(:lettings_log_id) { "0b4a68df-30cc-474a-93c0-a56ce8fdad3b" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
lettings_log_xml.at_xpath("//meta:status").content = "saved" |
|
|
|
|
|
|
|
lettings_log_xml.at_xpath("//xmlns:Q2b").content = "3" |
|
|
|
|
|
|
|
lettings_log_xml.at_xpath("//xmlns:Q2ba").content = "" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "intercepts the relevant validation error" do |
|
|
|
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect { lettings_log_service.send(:create_log, lettings_log_xml) } |
|
|
|
|
|
|
|
.not_to raise_error |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "clears out the invalid 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.tenancy).to be_nil |
|
|
|
|
|
|
|
expect(lettings_log.tenancyother).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "and this is an internal transfer from a non social housing" do |
|
|
|
context "and this is an internal transfer from a non social housing" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
lettings_log_xml.at_xpath("//xmlns:Q11").content = "9 Residential care home" |
|
|
|
lettings_log_xml.at_xpath("//xmlns:Q11").content = "9 Residential care home" |
|
|
|