Browse Source

Set extrabor to don't know it is not answered

pull/1443/head
Kat 3 years ago
parent
commit
5872d66a34
  1. 1
      app/services/imports/sales_logs_import_service.rb
  2. 16
      spec/services/imports/sales_logs_import_service_spec.rb

1
app/services/imports/sales_logs_import_service.rb

@ -510,6 +510,7 @@ module Imports
end end
attributes["pcodenk"] ||= 1 attributes["pcodenk"] ||= 1
attributes["prevten"] ||= 0 attributes["prevten"] ||= 0
attributes["extrabor"] ||= 3 if attributes["mortgageused"] == 1
# buyer 1 characteristics # buyer 1 characteristics
attributes["age1_known"] ||= 1 attributes["age1_known"] ||= 1

16
spec/services/imports/sales_logs_import_service_spec.rb

@ -1126,6 +1126,22 @@ RSpec.describe Imports::SalesLogsImportService do
expect(sales_log&.mortgageused).to eq(1) expect(sales_log&.mortgageused).to eq(1)
end end
end end
context "when the extrabor is not answered" do
let(:sales_log_id) { "discounted_ownership_sales_log" }
before do
sales_log_xml.at_xpath("//xmlns:Q35Borrowing").content = ""
allow(logger).to receive(:warn).and_return(nil)
end
it "sets extrabor to don't know" do
sales_log_service.send(:create_log, sales_log_xml)
sales_log = SalesLog.find_by(old_id: sales_log_id)
expect(sales_log&.extrabor).to be(3)
end
end
end end
end end
end end

Loading…
Cancel
Save