|
|
|
@ -254,6 +254,85 @@ RSpec.describe Validations::Sales::SoftValidations do
|
|
|
|
|
.not_to be_deposit_over_soft_max |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when validating shared ownership deposit" do |
|
|
|
|
it "returns false if MORTGAGE + DEPOSIT + CASHDIS are equal VALUE * EQUITY/100" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = 3000 |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if no mortgage is given" do |
|
|
|
|
record.mortgage = nil |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = 3000 |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if no deposit is given" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = nil |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = 3000 |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if no cashdis is given" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = nil |
|
|
|
|
record.value = 3000 |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if no value is given" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = nil |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns false if no equity is given" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = 3000 |
|
|
|
|
record.equity = nil |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.not_to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns true if MORTGAGE + DEPOSIT + CASHDIS are not equal VALUE * EQUITY/100" do |
|
|
|
|
record.mortgage = 1000 |
|
|
|
|
record.deposit = 1000 |
|
|
|
|
record.cashdis = 1000 |
|
|
|
|
record.value = 4323 |
|
|
|
|
record.equity = 100 |
|
|
|
|
|
|
|
|
|
expect(record) |
|
|
|
|
.to be_shared_ownership_deposit_invalid |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "hodate_more_than_3_years_before_saledate" do |
|
|
|
|