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["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["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["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")
@ -255,9 +248,10 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
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["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["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["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")
@ -267,12 +261,11 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
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["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")
end
end
it"does not add an error if mortgage, deposit and grant less than 1 greater than discounted value"do
it"does not add an error if mortgage, deposit and grant total equals discounted value"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
record.discount=46
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £15,000.00, and the purchase price times by the discount is £27,000.00. These figures should be the same")
end
it"returns false if mortgage and deposit total equals market value - discount"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["value"]).tobe_empty
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["deposit"]).tobe_empty
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["ownershipsch"]).tobe_empty
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["discount"]).tobe_empty
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["grant"]).tobe_empty
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £54,100.00, and the purchase price times by the discount is £54,027.00. These figures should be the same")
end
end
end
end
end
end
context"when neither discount nor grant is routed to"do
context"when neither discount nor grant is routed to"do