|
|
@ -2321,7 +2321,7 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#chcharge" do |
|
|
|
describe "#chcharge" do |
|
|
|
let(:attributes) { { bulk_upload:, field_127: "123.45", field_131: "123.45", field_130: "123.45", field_129: "123.45", field_128: "123.45" } } |
|
|
|
let(:attributes) { { bulk_upload:, field_127: "123.45" } } |
|
|
|
|
|
|
|
|
|
|
|
it "sets value given" do |
|
|
|
it "sets value given" do |
|
|
|
expect(parser.log.chcharge).to eq(123.45) |
|
|
|
expect(parser.log.chcharge).to eq(123.45) |
|
|
@ -2330,67 +2330,14 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do |
|
|
|
it "sets is care home to yes" do |
|
|
|
it "sets is care home to yes" do |
|
|
|
expect(parser.log.is_carehome).to eq(1) |
|
|
|
expect(parser.log.is_carehome).to eq(1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "clears any other given charges" do |
|
|
|
|
|
|
|
parser.log.save! |
|
|
|
|
|
|
|
expect(parser.log.tcharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.brent).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.supcharg).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.pscharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.scharge).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#tcharge" do |
|
|
|
describe "#tcharge" do |
|
|
|
let(:attributes) { { bulk_upload:, field_132: "123.45", field_127: "123.45", field_128: "123.45", field_129: "123.45", field_130: "123.45", field_131: "123.45" } } |
|
|
|
let(:attributes) { { bulk_upload:, field_132: "123.45" } } |
|
|
|
|
|
|
|
|
|
|
|
it "sets value given" do |
|
|
|
it "sets value given" do |
|
|
|
expect(parser.log.tcharge).to eq(123.45) |
|
|
|
expect(parser.log.tcharge).to eq(123.45) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when other charges are not given" do |
|
|
|
|
|
|
|
context "and it is carehome" do |
|
|
|
|
|
|
|
let(:attributes) { { bulk_upload:, field_132: "123.45", field_127: "123.45", field_128: nil, field_129: nil, field_130: nil, field_131: nil } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not set charges values" do |
|
|
|
|
|
|
|
parser.log.save! |
|
|
|
|
|
|
|
expect(parser.log.tcharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.brent).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.supcharg).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.pscharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.scharge).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add errors to missing charges" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_128]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_129]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_130]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_131]).to be_empty |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and it is not carehome" do |
|
|
|
|
|
|
|
let(:attributes) { { bulk_upload:, field_132: "123.45", field_127: nil, field_128: nil, field_129: nil, field_130: nil, field_131: nil } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not set charges values" do |
|
|
|
|
|
|
|
parser.log.save! |
|
|
|
|
|
|
|
expect(parser.log.tcharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.brent).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.supcharg).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.pscharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.scharge).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds an error to all missing charges" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_128]).to eql(["Please enter the basic rent. If there is no basic rent, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_129]).to eql(["Please enter the service charge. If there is no service charge, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_130]).to eql(["Please enter the personal service charge. If there is no personal service charge, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_131]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#supcharg" do |
|
|
|
describe "#supcharg" do |
|
|
@ -2399,50 +2346,6 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do |
|
|
|
it "sets value given" do |
|
|
|
it "sets value given" do |
|
|
|
expect(parser.log.supcharg).to eq(123.45) |
|
|
|
expect(parser.log.supcharg).to eq(123.45) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when other charges are not given" do |
|
|
|
|
|
|
|
context "and it is carehome" do |
|
|
|
|
|
|
|
let(:attributes) { { bulk_upload:, field_132: nil, field_127: "123.45", field_128: nil, field_129: nil, field_130: nil, field_131: "123.45" } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not set charges values" do |
|
|
|
|
|
|
|
parser.log.save! |
|
|
|
|
|
|
|
expect(parser.log.tcharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.brent).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.supcharg).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.pscharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.scharge).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not add errors to missing charges" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_128]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_129]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_130]).to be_empty |
|
|
|
|
|
|
|
expect(parser.errors[:field_131]).to be_empty |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and it is not carehome" do |
|
|
|
|
|
|
|
let(:attributes) { { bulk_upload:, field_132: "123.45", field_127: nil, field_128: nil, field_129: nil, field_130: nil, field_131: nil } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not set charges values" do |
|
|
|
|
|
|
|
parser.log.save! |
|
|
|
|
|
|
|
expect(parser.log.tcharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.brent).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.supcharg).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.pscharge).to be_nil |
|
|
|
|
|
|
|
expect(parser.log.scharge).to be_nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "adds an error to all missing charges" do |
|
|
|
|
|
|
|
parser.valid? |
|
|
|
|
|
|
|
expect(parser.errors[:field_128]).to eql(["Please enter the basic rent. If there is no basic rent, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_129]).to eql(["Please enter the service charge. If there is no service charge, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_130]).to eql(["Please enter the personal service charge. If there is no personal service charge, please enter '0'."]) |
|
|
|
|
|
|
|
expect(parser.errors[:field_131]).to eql(["Please enter the support charge. If there is no support charge, please enter '0'."]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#pscharge" do |
|
|
|
describe "#pscharge" do |
|
|
|