|
|
|
@ -13,6 +13,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
let(:managing_org) { create(:organisation, :with_old_visible_id) } |
|
|
|
|
let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) } |
|
|
|
|
let(:location) { create(:location, :with_old_visible_id, scheme:) } |
|
|
|
|
let(:mock_interrupion_ids) {} |
|
|
|
|
|
|
|
|
|
let(:setup_section_params) do |
|
|
|
|
{ |
|
|
|
@ -147,6 +148,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
mock_interrupion_ids |
|
|
|
|
create(:organisation_relationship, parent_organisation: owning_org, child_organisation: managing_org) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -987,6 +989,17 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
expect(parser.errors.where(:field_35, category: :soft_validation).first.message).to eql("You told us this person is aged 22 years and retired.") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when soft validation is triggered and the mappings for errors are not defined" do |
|
|
|
|
let(:attributes) { setup_section_params.merge({ field_12: 22, field_35: 5 }) } |
|
|
|
|
# rubocop:disable RSpec/AnyInstance |
|
|
|
|
let(:mock_interrupion_ids) { allow_any_instance_of(Form::Page).to receive(:interruption_screen_question_ids).and_return(%w[fake_question_id]) } |
|
|
|
|
# rubocop:enable RSpec/AnyInstance |
|
|
|
|
|
|
|
|
|
it "does not crash" do |
|
|
|
|
expect(parser.errors).to be_present |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|