|
|
|
@ -916,42 +916,42 @@ RSpec.describe Validations::FinancialValidations do |
|
|
|
context "and charges are over the valid limit (£1,000 per week)" do |
|
|
|
context "and charges are over the valid limit (£1,000 per week)" do |
|
|
|
it "validates charge when period is weekly for 52 weeks" do |
|
|
|
it "validates charge when period is weekly for 52 weeks" do |
|
|
|
record.period = 1 |
|
|
|
record.period = 1 |
|
|
|
record.chcharge = 1001 |
|
|
|
record.chcharge = 5001 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £1,000.00 if paying weekly for 52 weeks") |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £1,000.00 if paying weekly for 52 weeks") |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is monthly" do |
|
|
|
it "validates charge when period is monthly" do |
|
|
|
record.period = 4 |
|
|
|
record.period = 4 |
|
|
|
record.chcharge = 4334 |
|
|
|
record.chcharge = 21_667 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £4,333.00 if paying every calendar month") |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £4,333.00 if paying every calendar month") |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is every 2 weeks" do |
|
|
|
it "validates charge when period is every 2 weeks" do |
|
|
|
record.period = 2 |
|
|
|
record.period = 2 |
|
|
|
record.chcharge = 2001 |
|
|
|
record.chcharge = 12_001 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £2,000.00 if paying every 2 weeks") |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £2,000.00 if paying every 2 weeks") |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is every 4 weeks" do |
|
|
|
it "validates charge when period is every 4 weeks" do |
|
|
|
record.period = 3 |
|
|
|
record.period = 3 |
|
|
|
record.chcharge = 4001 |
|
|
|
record.chcharge = 24_001 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £4,000.00 if paying every 4 weeks") |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £4,000.00 if paying every 4 weeks") |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
@ -1007,9 +1007,9 @@ RSpec.describe Validations::FinancialValidations do |
|
|
|
record.chcharge = 9 |
|
|
|
record.chcharge = 9 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £1,000.00 if paying weekly for 52 weeks") |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £1,000.00 if paying weekly for 52 weeks") |
|
|
|
.to include("Household rent and other charges must be between £10.00 and £5,000.00 if paying weekly for 52 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is monthly" do |
|
|
|
it "validates charge when period is monthly" do |
|
|
|
@ -1017,9 +1017,9 @@ RSpec.describe Validations::FinancialValidations do |
|
|
|
record.chcharge = 42 |
|
|
|
record.chcharge = 42 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £4,333.00 if paying every calendar month") |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £4,333.00 if paying every calendar month") |
|
|
|
.to include("Household rent and other charges must be between £43.00 and £21,666.00 if paying every calendar month") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is every 2 weeks" do |
|
|
|
it "validates charge when period is every 2 weeks" do |
|
|
|
@ -1027,9 +1027,9 @@ RSpec.describe Validations::FinancialValidations do |
|
|
|
record.chcharge = 19 |
|
|
|
record.chcharge = 19 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £2,000.00 if paying every 2 weeks") |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £2,000.00 if paying every 2 weeks") |
|
|
|
.to include("Household rent and other charges must be between £20.00 and £10,000.00 if paying every 2 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "validates charge when period is every 4 weeks" do |
|
|
|
it "validates charge when period is every 4 weeks" do |
|
|
|
@ -1037,9 +1037,9 @@ RSpec.describe Validations::FinancialValidations do |
|
|
|
record.chcharge = 39 |
|
|
|
record.chcharge = 39 |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
financial_validator.validate_care_home_charges(record) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
expect(record.errors["chcharge"]) |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £4,000.00 if paying every 4 weeks") |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks") |
|
|
|
expect(record.errors["period"]) |
|
|
|
expect(record.errors["period"]) |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £4,000.00 if paying every 4 weeks") |
|
|
|
.to include("Household rent and other charges must be between £40.00 and £20,000.00 if paying every 4 weeks") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|