expect(record.errors["mortgageused"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £49,999.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage (£30,000.00), cash deposit (£5,000.00), and grant (£15,000.00) added together is £50,000.00.</br></br>The full purchase price is £50,001.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage (£66,113.00) and cash deposit (£0.00) added together is £66,113.00.</br></br>The full purchase price (£123,000.00) subtracted by the sum of the full purchase price (£123,000.00) multiplied by the percentage discount (46.3%) is £66,051.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage (£10,000.00) and cash deposit (£2,000.00) added together is £12,000.00.</br></br>The full purchase price is £30,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage (£10.00), cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,010.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["discount"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["grant"]).toinclude("The mortgage, cash deposit (£5,000.00), and grant (£3,000.00) added together is £8,000.00.</br></br>The full purchase price (£20,000.00) subtracted by the sum of the full purchase price (£20,000.00) multiplied by the percentage discount (10.0%) is £18,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The mortgage (£100,000.00) and cash deposit (£100,000.00) when added together is £200,000.00.</br></br>The full purchase price is £300,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage (£100,000.00) and cash deposit (£100,000.00) when added together is £200,000.00.</br></br>The full purchase price is £300,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£100,000.00) and cash deposit (£100,000.00) when added together is £200,000.00.</br></br>The full purchase price is £300,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£100,000.00) and cash deposit (£100,000.00) when added together is £200,000.00.</br></br>The full purchase price is £300,000.00.</br></br>These two amounts should be the same.")
expect(record.errors["ownershipsch"]).toinclude("The mortgage (£100,000.00) and cash deposit (£100,000.00) when added together is £200,000.00.</br></br>The full purchase price is £300,000.00.</br></br>These two amounts 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 (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["equity"]).toinclude("The mortgage (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["type"]).toinclude("The mortgage (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The mortgage (£10,000.00) and cash deposit (£5,000.00) added together is £15,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgage"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["equity"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["cashdis"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["type"]).toinclude("The mortgage amount (£10,000.00), cash deposit (£5,000.00), and cash discount (£200.00) added together is £15,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage equity stake purchased (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["equity"]).toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["type"]).toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["cashdis"]).not_toinclude("The cash deposit is £5,000.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["mortgageused"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["value"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["deposit"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["equity"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["cashdis"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
expect(record.errors["type"]).toinclude("The cash deposit (£5,000.00) and cash discount (£200.00) added together is £5,200.00.</br></br>The full purchase price (£30,000.00) multiplied by the percentage bought (28.0%) is £8,400.00.</br></br>These two amounts should be the same.")
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."