|
|
|
@ -1991,9 +1991,44 @@ RSpec.describe BulkUpload::Sales::Year2026::RowParser do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to 0.0" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_10: "2", field_107: "0.0") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_107]).to include(I18n.t("validations.sales.2026.bulk_upload.mscharge.invalid")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when set to R" do |
|
|
|
context "when set to R" do |
|
|
|
let(:attributes) { valid_attributes.merge(field_10: "2", field_107: "R") } |
|
|
|
let(:attributes) { valid_attributes.merge(field_10: "2", field_107: "R") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_107]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to lowercase r" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_10: "2", field_107: "r") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_107]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
log = parser.log |
|
|
|
log = parser.log |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
@ -2083,9 +2118,44 @@ RSpec.describe BulkUpload::Sales::Year2026::RowParser do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to 0.0" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_125: "0.0") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_125]).to include(I18n.t("validations.sales.2026.bulk_upload.mscharge.invalid")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when set to R" do |
|
|
|
context "when set to R" do |
|
|
|
let(:attributes) { valid_attributes.merge(field_125: "R") } |
|
|
|
let(:attributes) { valid_attributes.merge(field_125: "R") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_125]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to lowercase r" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_125: "r") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_125]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
log = parser.log |
|
|
|
log = parser.log |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
@ -2175,9 +2245,44 @@ RSpec.describe BulkUpload::Sales::Year2026::RowParser do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to 0.0" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_8: "2", field_136: "0.0") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_136]).to include(I18n.t("validations.sales.2026.bulk_upload.mscharge.invalid")) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when set to R" do |
|
|
|
context "when set to R" do |
|
|
|
let(:attributes) { valid_attributes.merge(field_8: "2", field_136: "R") } |
|
|
|
let(:attributes) { valid_attributes.merge(field_8: "2", field_136: "R") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_136]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
|
|
|
|
log = parser.log |
|
|
|
|
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|
|
|
|
expect(log["mscharge"]).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when set to lowercase r" do |
|
|
|
|
|
|
|
let(:attributes) { valid_attributes.merge(field_8: "2", field_136: "r") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add a validation error" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_136]).to be_blank |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
it "sets has_mscharge to no and does not set mscharge" do |
|
|
|
log = parser.log |
|
|
|
log = parser.log |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
expect(log["has_mscharge"]).to eq(0) |
|
|
|
|