|
|
|
@ -900,7 +900,7 @@ RSpec.describe Imports::SalesLogsImportService do
|
|
|
|
|
.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "clears out the referral answer" do |
|
|
|
|
it "clears out the mortgage answer" do |
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
sales_log_service.send(:create_log, sales_log_xml) |
|
|
|
@ -911,6 +911,29 @@ RSpec.describe Imports::SalesLogsImportService do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when proplen is out of range" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q16aProplen2").content = "2000" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "intercepts the relevant validation error" do |
|
|
|
|
expect { sales_log_service.send(:create_log, sales_log_xml) } |
|
|
|
|
.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "clears out the proplen answer" do |
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
sales_log_service.send(:create_log, sales_log_xml) |
|
|
|
|
sales_log = SalesLog.find_by(old_id: sales_log_id) |
|
|
|
|
|
|
|
|
|
expect(sales_log).not_to be_nil |
|
|
|
|
expect(sales_log.proplen).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and it has an invalid income 1" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
@ -961,6 +984,34 @@ RSpec.describe Imports::SalesLogsImportService do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and it has an invalid combined income outside london" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:joint").content = "1 Yes" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q2Person1Income").content = "45000" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:P2IncKnown").content = "1 Yes" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q2Person2Income").content = "40000" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q14ONSLACode").content = "E07000223" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "intercepts the relevant validation error" do |
|
|
|
|
expect { sales_log_service.send(:create_log, sales_log_xml) } |
|
|
|
|
.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "clears out the invalid answers" do |
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
sales_log_service.send(:create_log, sales_log_xml) |
|
|
|
|
sales_log = SalesLog.find_by(old_id: sales_log_id) |
|
|
|
|
|
|
|
|
|
expect(sales_log).not_to be_nil |
|
|
|
|
expect(sales_log.income1).to be_nil |
|
|
|
|
expect(sales_log.income2).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and it has an invalid income 1 for london" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
@ -1011,6 +1062,34 @@ RSpec.describe Imports::SalesLogsImportService do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and it has an invalid combined income for london" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:joint").content = "1 Yes" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q2Person1Income").content = "50000" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:P2IncKnown").content = "1 Yes" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q2Person2Income").content = "45000" |
|
|
|
|
sales_log_xml.at_xpath("//xmlns:Q14ONSLACode").content = "E09000012" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "intercepts the relevant validation error" do |
|
|
|
|
expect { sales_log_service.send(:create_log, sales_log_xml) } |
|
|
|
|
.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "clears out the invalid answers" do |
|
|
|
|
allow(logger).to receive(:warn) |
|
|
|
|
|
|
|
|
|
sales_log_service.send(:create_log, sales_log_xml) |
|
|
|
|
sales_log = SalesLog.find_by(old_id: sales_log_id) |
|
|
|
|
|
|
|
|
|
expect(sales_log).not_to be_nil |
|
|
|
|
expect(sales_log.income1).to be_nil |
|
|
|
|
expect(sales_log.income2).to be_nil |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and it has an invalid mscharge" do |
|
|
|
|
let(:sales_log_id) { "shared_ownership_sales_log" } |
|
|
|
|
|
|
|
|
|