expect(record.errors[:stairowned]).toinclude("The percentage owned has to be 100% if the mortgage used is 'Don’t know'")
context"and stairowned is less than 100"do
expect(record.errors[:mortgageused]).toinclude("The percentage owned has to be 100% if the mortgage used is 'Don’t know'")
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."