|
|
|
|
@ -128,7 +128,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if only income1 is used for morgage and it is less than 1/5 of the morgage" do |
|
|
|
|
it "returns true if only income1 is used for mortgage and it is less than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 1 |
|
|
|
|
record.income1 = 10_000 |
|
|
|
|
record.mortgage = 51_000 |
|
|
|
|
@ -137,7 +137,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if only income1 is used for morgage and it is more than 1/5 of the morgage" do |
|
|
|
|
it "returns false if only income1 is used for mortgage and it is more than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 1 |
|
|
|
|
record.income1 = 10_000 |
|
|
|
|
record.mortgage = 44_000 |
|
|
|
|
@ -146,7 +146,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if only income2 is used for morgage and it is less than 1/5 of the morgage" do |
|
|
|
|
it "returns true if only income2 is used for mortgage and it is less than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 2 |
|
|
|
|
record.inc2mort = 1 |
|
|
|
|
record.income2 = 10_000 |
|
|
|
|
@ -155,7 +155,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if only income2 is used for morgage and it is more than 1/5 of the morgage" do |
|
|
|
|
it "returns false if only income2 is used for mortgage and it is more than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 2 |
|
|
|
|
record.inc2mort = 1 |
|
|
|
|
record.income2 = 10_000 |
|
|
|
|
@ -164,7 +164,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if income1 and income2 are used for morgage and their sum is less than 1/5 of the morgage" do |
|
|
|
|
it "returns true if income1 and income2 are used for mortgage and their sum is less than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 1 |
|
|
|
|
record.inc2mort = 1 |
|
|
|
|
record.income1 = 10_000 |
|
|
|
|
@ -174,7 +174,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if income1 and income2 are used for morgage and their sum is more than 1/5 of the morgage" do |
|
|
|
|
it "returns false if income1 and income2 are used for mortgage and their sum is more than 1/5 of the mortgage" do |
|
|
|
|
record.inc1mort = 1 |
|
|
|
|
record.inc2mort = 1 |
|
|
|
|
record.income1 = 8_000 |
|
|
|
|
@ -184,7 +184,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if neither of the incomes are used for morgage and the morgage is more than 0" do |
|
|
|
|
it "returns true if neither of the incomes are used for mortgage and the mortgage is more than 0" do |
|
|
|
|
record.inc1mort = 2 |
|
|
|
|
record.inc2mort = 2 |
|
|
|
|
record.mortgage = 124_000 |
|
|
|
|
@ -192,7 +192,7 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if neither of the incomes are used for morgage and the morgage is 0" do |
|
|
|
|
it "returns false if neither of the incomes are used for mortgage and the mortgage is 0" do |
|
|
|
|
record.inc1mort = 2 |
|
|
|
|
record.inc2mort = 2 |
|
|
|
|
record.mortgage = 0 |
|
|
|
|
@ -200,6 +200,73 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_mortgage_over_soft_max |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when validating extra borrowing" do |
|
|
|
|
it "returns false if extrabor not present" do |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if deposit not present" do |
|
|
|
|
record.extrabor = 2 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if deposit not present" do |
|
|
|
|
record.extrabor = 2 |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if value not present" do |
|
|
|
|
record.extrabor = 2 |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if discount not present" do |
|
|
|
|
record.extrabor = 2 |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if extra borrowing expected and reported" do |
|
|
|
|
record.extrabor = 1 |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if extra borrowing expected but not reported" do |
|
|
|
|
record.extrabor = 2 |
|
|
|
|
record.mortgage = 50_000 |
|
|
|
|
record.deposit = 40_000 |
|
|
|
|
record.value = 100_000 |
|
|
|
|
record.discount = 11 |
|
|
|
|
expect(record) |
|
|
|
|
.to be_extra_borrowing_expected_but_not_reported |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "savings amount validations" do |
|
|
|
|
|