|
|
|
@ -649,6 +649,28 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#field_68 - 74" do |
|
|
|
|
context "when not homeless but reasonable preference for homelessness" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_68: "1", field_69: "1", field_70: "1" } } |
|
|
|
|
|
|
|
|
|
it "is not permitted" do |
|
|
|
|
expect(parser.errors[:field_70]).to be_present |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when there is a reasonable preference but none is given" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_69: "1", field_70: nil, field_71: nil, field_72: nil, field_73: nil, field_74: nil } } |
|
|
|
|
|
|
|
|
|
it "is not permitted" do |
|
|
|
|
expect(parser.errors[:field_70]).to be_present |
|
|
|
|
expect(parser.errors[:field_71]).to be_present |
|
|
|
|
expect(parser.errors[:field_72]).to be_present |
|
|
|
|
expect(parser.errors[:field_73]).to be_present |
|
|
|
|
expect(parser.errors[:field_74]).to be_present |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#field_78" do # referral |
|
|
|
|
context "when 3 ie PRP nominated by LA and owning org is LA" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_78: "3", field_111: owning_org.old_visible_id } } |
|
|
|
@ -779,6 +801,20 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#field_103" do |
|
|
|
|
context "when null" do |
|
|
|
|
let(:attributes) { setup_section_params.merge({ field_103: nil }) } |
|
|
|
|
|
|
|
|
|
it "returns an error" do |
|
|
|
|
expect(parser.errors[:field_103]).to be_present |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "populates with correct error message" do |
|
|
|
|
expect(parser.errors[:field_103]).to eql(["You must answer type of building"]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#field_111" do # owning org |
|
|
|
|
context "when no data given" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_1: "1", field_111: "" } } |
|
|
|
@ -937,16 +973,38 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#field_103" do |
|
|
|
|
context "when null" do |
|
|
|
|
let(:attributes) { setup_section_params.merge({ field_103: nil }) } |
|
|
|
|
describe "#field_118, field_119 - 128" do |
|
|
|
|
context "when no illness but illnesses answered" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_118: "2", field_119: "1", field_120: "1", field_121: "1" } } |
|
|
|
|
|
|
|
|
|
it "returns an error" do |
|
|
|
|
expect(parser.errors[:field_103]).to be_present |
|
|
|
|
it "errors added to correct fields" do |
|
|
|
|
expect(parser.errors[:field_119]).to be_present |
|
|
|
|
expect(parser.errors[:field_120]).to be_present |
|
|
|
|
expect(parser.errors[:field_121]).to be_present |
|
|
|
|
expect(parser.errors[:field_122]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_123]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_124]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_125]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_126]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_127]).not_to be_present |
|
|
|
|
expect(parser.errors[:field_128]).not_to be_present |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "populates with correct error message" do |
|
|
|
|
expect(parser.errors[:field_103]).to eql(["You must answer type of building"]) |
|
|
|
|
context "when illness but no illnesses answered" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_118: "1", field_119: nil, field_120: nil, field_121: nil, field_122: nil, field_123: nil, field_124: nil, field_125: nil, field_126: nil, field_127: nil, field_128: nil } } |
|
|
|
|
|
|
|
|
|
it "errors added to correct fields" do |
|
|
|
|
expect(parser.errors[:field_119]).to be_present |
|
|
|
|
expect(parser.errors[:field_120]).to be_present |
|
|
|
|
expect(parser.errors[:field_121]).to be_present |
|
|
|
|
expect(parser.errors[:field_122]).to be_present |
|
|
|
|
expect(parser.errors[:field_123]).to be_present |
|
|
|
|
expect(parser.errors[:field_124]).to be_present |
|
|
|
|
expect(parser.errors[:field_125]).to be_present |
|
|
|
|
expect(parser.errors[:field_126]).to be_present |
|
|
|
|
expect(parser.errors[:field_127]).to be_present |
|
|
|
|
expect(parser.errors[:field_128]).to be_present |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|