expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £66,113.00, and the purchase price times by the discount is £66,051.00. These figures should be the same")
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £12,000.00, and the purchase price times by the discount is £30,000.00. These figures should be the same")
end
it"returns false if mortgage and deposit total equals market value"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £8,010.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
end
it"returns false if mortgage, grant and deposit total equals market value - discount"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £8,000.00, and the purchase price times by the discount is £18,000.00. These figures should be the same")
end
it"returns false if mortgage, grant and deposit total equals market value - discount"do
expect(record.errors["mortgageused"]).toinclude("The mortgage and deposit when added together is £200,000.00, and the purchase price is £300,000.00. These figures should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage and deposit when added together is £200,000.00, and the purchase price is £300,000.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage and deposit when added together is £200,000.00, and the purchase price is £300,000.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The mortgage and deposit when added together is £200,000.00, and the purchase price is £300,000.00. These figures should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage and deposit when added together is £200,000.00, and the purchase price is £300,000.00. These figures should be the same.")
expect(record.errors[:stairbought]).toinclude("The percentage bought in this staircasing transaction cannot be higher than #{max}% for #{label} sales.")
expect(record.errors[:type]).toinclude("The percentage bought in this staircasing transaction cannot be higher than #{max}% for #{label} sales.")
end
end
end
context"when the collection year is before 2024"do
expect(record.errors["value"]).toinclude("The percentage discount multiplied by the purchase price is £160,000.00. This figure should not be more than £136,400 for properties in London.")
expect(record.errors["discount"]).toinclude("The percentage discount multiplied by the purchase price is £160,000.00. This figure should not be more than £136,400 for properties in London.")
expect(record.errors["la"]).toinclude("The percentage discount multiplied by the purchase price is £160,000.00. This figure should not be more than £136,400 for properties in London.")
expect(record.errors["postcode_full"]).toinclude("The percentage discount multiplied by the purchase price is £160,000.00. This figure should not be more than £136,400 for properties in London.")
expect(record.errors["uprn"]).toinclude("The percentage discount multiplied by the purchase price is £160,000.00. This figure should not be more than £136,400 for properties in London.")
end
it"does not add an error value * discount is less than 136,400"do
expect(record.errors["value"]).toinclude("The percentage discount multiplied by the purchase price is £104,000.00. This figure should not be more than £102,400 for properties outside of London.")
expect(record.errors["discount"]).toinclude("The percentage discount multiplied by the purchase price is £104,000.00. This figure should not be more than £102,400 for properties outside of London.")
expect(record.errors["la"]).toinclude("The percentage discount multiplied by the purchase price is £104,000.00. This figure should not be more than £102,400 for properties outside of London.")
expect(record.errors["postcode_full"]).toinclude("The percentage discount multiplied by the purchase price is £104,000.00. This figure should not be more than £102,400 for properties outside of London.")
expect(record.errors["uprn"]).toinclude("The percentage discount multiplied by the purchase price is £104,000.00. This figure should not be more than £102,400 for properties outside of London.")
end
it"does not add an error value * discount is less than 136,400"do
expect(record.errors["mortgage"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["equity"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["equity"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
end
end
context"and it is not a shared ownership transaction"do
expect(record.errors["mortgageused"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["equity"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["mortgageused"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["equity"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
end
end
context"and it is not a shared ownership transaction"do
expect(record.errors["mortgage"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["stairbought"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The mortgage and deposit added together is £15,000.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["stairbought"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The mortgage, deposit, and cash discount added together is £15,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
end
end
context"and it is not a shared ownership transaction"do
expect(record.errors["mortgageused"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["stairbought"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The deposit is £5,000.00 and the value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["mortgageused"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["value"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["deposit"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["stairbought"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["cashdis"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
expect(record.errors["type"]).toinclude("The deposit and cash discount added together is £5,200.00. The value multiplied by the percentage bought is £8,400.00. These figures should be the same.")
end
end
context"and it is not a shared ownership transaction"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."