|
|
|
@ -6,7 +6,7 @@ RSpec.describe Validations::Sales::FinancialValidations do
|
|
|
|
|
let(:validator_class) { Class.new { include Validations::Sales::FinancialValidations } } |
|
|
|
|
|
|
|
|
|
describe "income validations" do |
|
|
|
|
let(:record) { FactoryBot.create(:sales_log, ownershipsch: 1) } |
|
|
|
|
let(:record) { FactoryBot.create(:sales_log, ownershipsch: 1, la: "E08000035") } |
|
|
|
|
|
|
|
|
|
context "with shared ownership" do |
|
|
|
|
context "and non london borough" do |
|
|
|
@ -21,6 +21,10 @@ RSpec.describe Validations::Sales::FinancialValidations do
|
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 80_000)) |
|
|
|
|
expect(record.errors["ownershipsch"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 80_000)) |
|
|
|
|
expect(record.errors["la"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 80_000)) |
|
|
|
|
expect(record.errors["postcode_full"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 80_000)) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -31,6 +35,8 @@ RSpec.describe Validations::Sales::FinancialValidations do
|
|
|
|
|
expect(record.errors["income1"]).to be_empty |
|
|
|
|
expect(record.errors["ecstat1"]).to be_empty |
|
|
|
|
expect(record.errors["ownershipsch"]).to be_empty |
|
|
|
|
expect(record.errors["la"]).to be_empty |
|
|
|
|
expect(record.errors["postcode_full"]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -51,6 +57,10 @@ RSpec.describe Validations::Sales::FinancialValidations do
|
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 90_000)) |
|
|
|
|
expect(record.errors["ownershipsch"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 90_000)) |
|
|
|
|
expect(record.errors["la"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 90_000)) |
|
|
|
|
expect(record.errors["postcode_full"]) |
|
|
|
|
.to include(match I18n.t("validations.financial.income1.over_hard_max", hard_max: 90_000)) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -61,6 +71,8 @@ RSpec.describe Validations::Sales::FinancialValidations do
|
|
|
|
|
expect(record.errors["income1"]).to be_empty |
|
|
|
|
expect(record.errors["ecstat1"]).to be_empty |
|
|
|
|
expect(record.errors["ownershipsch"]).to be_empty |
|
|
|
|
expect(record.errors["la"]).to be_empty |
|
|
|
|
expect(record.errors["postcode_full"]).to be_empty |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|