Browse Source

Update tests to use decimal discount

pull/2427/head
Rachael Booth 2 years ago
parent
commit
1b8d4c05c2
  1. 28
      spec/models/validations/sales/sale_information_validations_spec.rb

28
spec/models/validations/sales/sale_information_validations_spec.rb

@ -321,10 +321,10 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
end end
it "does not add errors if mortgage and deposit total is within a 0.05% x market value tolerance of market value - discount" do it "does not add errors if mortgage and deposit total is within a 0.05% x market value tolerance of market value - discount" do
record.value = 100_050 record.value = 123_000
record.mortgage = 54_000 record.mortgage = 66_112
record.deposit = 0 record.deposit = 0 # This would be a 46.25% discount
record.discount = 46 record.discount = 46.3
sale_information_validator.validate_discounted_ownership_value(record) sale_information_validator.validate_discounted_ownership_value(record)
@ -338,20 +338,20 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
end end
it "adds errors if mortgage and deposit total is not within a 0.05% x market value tolerance of market value - discount" do it "adds errors if mortgage and deposit total is not within a 0.05% x market value tolerance of market value - discount" do
record.value = 100_050 record.value = 123_000
record.mortgage = 54_100 record.mortgage = 66_113
record.deposit = 0 record.deposit = 0
record.discount = 46 record.discount = 46.3
sale_information_validator.validate_discounted_ownership_value(record) sale_information_validator.validate_discounted_ownership_value(record)
expect(record.errors["mortgageused"]).to include("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["mortgageused"]).to include("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"]).to include("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["mortgage"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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"]).to include("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")
end end
end end
end end

Loading…
Cancel
Save