CLDC-4215, CLDC-4216: Add mortgage used Don't Know option (#3208)
* CLDC-4215: Show Don't Know on all paths of mortgageused
* CLDC-4215: Update tests
* fixup! CLDC-4215: Show Don't Know on all paths of mortgageused
* fixup! CLDC-4215: Update tests
cover all cases
* fixup! CLDC-4215: Show Don't Know on all paths of mortgageused
* fixup! CLDC-4215: Update tests
expect(sales_log.errors[:mortgageused]).toinclude"Enter a valid value for was a mortgage used for the purchase of this property?"
context"and it is a discounted ownership sale"do
let(:ownershipsch){2}
it"adds an error"do
expect(sales_log.errors[:mortgageused]).toinclude"Enter a valid value for was a mortgage used for the purchase of this property?"
end
end
end
context"and it is an outright sale"do
let(:ownershipsch){3}
context"and it is an outright sale"do
let(:ownershipsch){3}
it"does not add any errors"do
expect(sales_log.errors).tobe_empty
it"does not add any errors"do
expect(sales_log.errors).tobe_empty
end
end
end
context"and it is a shared ownership scheme sale"do
let(:ownershipsch){1}
context"and it is a shared ownership scheme sale"do
let(:ownershipsch){1}
context"and a staircasing transaction"do
let(:staircase){1}
context"and a staircasing transaction"do
let(:staircase){1}
context"and stairowned is nil"do
let(:stairowned){nil}
context"and stairowned is nil"do
let(:stairowned){nil}
it"does not add an error"do
expect(sales_log.errors).tobe_empty
it"does not add an error"do
expect(sales_log.errors).tobe_empty
end
end
end
context"and stairowned is less than 100"do
let(:stairowned){50}
context"and stairowned is less than 100"do
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'"
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 stairowned is 100"do
let(:stairowned){100}
context"and not a staircasing transaction"do
let(:staircase){2}
it"does not add an error"do
expect(sales_log.errors).tobe_empty
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."
end
end
end
end
context"and not a staircasing transaction"do
let(:staircase){2}
context"when mortgageused is not don't know"do
let(:mortgageused){1}
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."