|
|
|
@ -120,12 +120,8 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when valid row" do |
|
|
|
|
before do |
|
|
|
|
allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:attributes) do |
|
|
|
|
context "when testing valid/invalid attributes" do |
|
|
|
|
let(:valid_attributes) do |
|
|
|
|
{ |
|
|
|
|
bulk_upload:, |
|
|
|
|
field_5: "1", |
|
|
|
@ -250,6 +246,13 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
|
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when valid row" do |
|
|
|
|
before do |
|
|
|
|
allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:attributes) { valid_attributes } |
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
expect(parser).to be_valid |
|
|
|
|
end |
|
|
|
@ -376,6 +379,31 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when valid row with valid decimal (integer) field_5" do |
|
|
|
|
before do |
|
|
|
|
allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_5: "1.00") } |
|
|
|
|
|
|
|
|
|
it "returns true" do |
|
|
|
|
expect(parser).to be_valid |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when valid row with invalid decimal (non-integer) field_5" do |
|
|
|
|
before do |
|
|
|
|
allow(FeatureToggle).to receive(:bulk_upload_duplicate_log_check_enabled?).and_return(true) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_5: "1.56") } |
|
|
|
|
|
|
|
|
|
it "returns false" do |
|
|
|
|
expect(parser).not_to be_valid |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#validate_nulls" do |
|
|
|
|
context "when non-setup questions are null" do |
|
|
|
|
let(:attributes) { { bulk_upload:, field_1: "a", field_18: "", field_19: "", field_21: "" } } |
|
|
|
|