Browse Source

Add a test

pull/1648/head
Kat 3 years ago
parent
commit
e0e79690e2
  1. 13
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

13
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -13,6 +13,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
let(:managing_org) { create(:organisation, :with_old_visible_id) } let(:managing_org) { create(:organisation, :with_old_visible_id) }
let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) } let(:scheme) { create(:scheme, :with_old_visible_id, owning_organisation: owning_org) }
let(:location) { create(:location, :with_old_visible_id, scheme:) } let(:location) { create(:location, :with_old_visible_id, scheme:) }
let(:mock_interrupion_ids) {}
let(:setup_section_params) do let(:setup_section_params) do
{ {
@ -147,6 +148,7 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
end end
before do before do
mock_interrupion_ids
create(:organisation_relationship, parent_organisation: owning_org, child_organisation: managing_org) create(:organisation_relationship, parent_organisation: owning_org, child_organisation: managing_org)
end 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.") 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
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
end end

Loading…
Cancel
Save