Browse Source

CLDC-1228: Handles soft validation confirmations (#749)

pull/754/head
Stéphane Meny 2 years ago committed by GitHub
parent
commit
b3c07ba229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      app/services/imports/case_logs_import_service.rb
  2. 13
      spec/services/imports/case_logs_import_service_spec.rb

9
app/services/imports/case_logs_import_service.rb

@ -207,6 +207,13 @@ module Imports
attributes["postcode_full"] = nil attributes["postcode_full"] = nil
end end
# Soft validations can become required answers, set them to yes by default
attributes["pregnancy_value_check"] = 0
attributes["retirement_value_check"] = 0
attributes["rent_value_check"] = 0
attributes["net_income_value_check"] = 0
# Sets the log creator
owner_id = field_value(xml_doc, "meta", "owner-user-id").strip owner_id = field_value(xml_doc, "meta", "owner-user-id").strip
if owner_id.present? if owner_id.present?
attributes["created_by"] = User.find_by(old_user_id: owner_id) attributes["created_by"] = User.find_by(old_user_id: owner_id)
@ -266,7 +273,7 @@ module Imports
end end
def fields_not_present_in_softwire_data def fields_not_present_in_softwire_data
%w[majorrepairs illness_type_0 tshortfall_known] %w[majorrepairs illness_type_0 tshortfall_known pregnancy_value_check retirement_value_check rent_value_check net_income_value_check]
end end
def check_status_completed(case_log, previous_status) def check_status_completed(case_log, previous_status)

13
spec/services/imports/case_logs_import_service_spec.rb

@ -216,6 +216,19 @@ RSpec.describe Imports::CaseLogsImportService do
end end
end end
context "and the net income soft validation is triggered" do
before do
case_log_xml.at_xpath("//xmlns:Q8a").content = "1 Weekly"
case_log_xml.at_xpath("//xmlns:Q8Money").content = 890.00
end
it "completes the log" do
case_log_service.send(:create_log, case_log_xml)
case_log = CaseLog.find_by(old_id: case_log_id)
expect(case_log.status).to eq("completed")
end
end
context "and this is a supported housing log with multiple locations under a scheme" do context "and this is a supported housing log with multiple locations under a scheme" do
let(:case_log_id) { "0b4a68df-30cc-474a-93c0-a56ce8fdad3b" } let(:case_log_id) { "0b4a68df-30cc-474a-93c0-a56ce8fdad3b" }

Loading…
Cancel
Save