over_max:"The maximum initial equity stake is %{max_equity}%"
over_stairowned_minus_stairbought:"The initial equity stake is %{equity}% and the percentage owned in total minus the percentage bought is %{staircase_difference}%. In a staircasing transaction, the equity stake purchased cannot be larger than the percentage the %{buyer_owns} minus the percentage bought."
mortgage:"Mortgage value cannot be £0 if a mortgage was used for the purchase of this property"
mortgage_used:
year:"You must answer either ‘yes’ or ‘no’ to the question ‘was a mortgage used’ for the selected year."
staircasing:"You must answer either ‘yes’ or ‘no’ to the question ‘was a mortgage used’ for staircasing transactions."
shared_ownership_deposit:"The %{mortgage_deposit_and_discount_error_fields} added together is %{mortgage_deposit_and_discount_total}. The value times the equity percentage is %{value_times_equity}. These figures should be the same"
context"and it is a shared ownership scheme sale"do
let(:ownershipsch){1}
context"and a staircasing transaction"do
let(:staircase){1}
expect(record.errors[:stairowned]).toinclude("The percentage owned has to be 100% if the mortgage used is 'Don’t know'")
expect(record.errors[:mortgageused]).toinclude("The percentage owned has to be 100% if the mortgage used is 'Don’t know'")
context"and stairowned is nil"do
let(:stairowned){nil}
it"does not add an error"do
expect(sales_log.errors).tobe_empty
end
end
context"and stairowned is less than 100"do
let(:stairowned){50}
it"adds errors"do
expect(sales_log.errors[:mortgageused]).toinclude"The percentage owned has to be 100% if the mortgage used is 'Don’t know'"
expect(sales_log.errors[:stairowned]).toinclude"The percentage owned has to be 100% if the mortgage used is 'Don’t know'"
end
end
context"and stairowned is 100"do
let(:stairowned){100}
it"does not add an error"do
expect(sales_log.errors).tobe_empty
end
end
end
context"and not a staircasing transaction"do
let(:staircase){2}
it"adds errors"do
expect(sales_log.errors[:mortgageused]).toinclude"Enter a valid value for was a mortgage used for the purchase of this property?"
expect(sales_log.errors[:staircase]).toinclude"You must answer either ‘yes’ or ‘no’ to the question ‘was a mortgage used’ for staircasing transactions."
end
end
end
end
context"when the collection year is before 2024"do