-
-
Notifications
You must be signed in to change notification settings - Fork 540
validates the item purchase fields for diapers, #5076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
validates the item purchase fields for diapers, #5076
Conversation
adult incontinence, period, other as >= 0, added tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick re the test description - otherwise this LGTM
expect(d).not_to be_valid | ||
end | ||
|
||
it "is valid if all categories are positive" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say "is valid if all categories are positive and add up to the total"
@dorner -- do you want to take a technical pass on this? My nitpick is small enough that we could just edit the file on behalf of @jahuang415 , methinks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also would like a comment removed :)
@@ -54,6 +54,29 @@ | |||
expect(d).to be_valid | |||
end | |||
|
|||
# re 5059-non-negative-purchase_value, adding in amount_spent_on_period_supplies_cents to test. | |||
# also adding in amount_spend_on_incontinence_cents because it was missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment isn't necessary - this belongs in the PR, not in the code.
Resolves #5059
Description
Before the change, a user could a new purchase with negative dollar values for the respective items (other, incontinence, etc.) and it would be valid so long as the total sum was correct and greater than zero.
A validation was added such that each purchase item must be greater than or equal to zero, and a respective rspec test was added to check.
Type of change
How Has This Been Tested?
Create a new purchase, and set the following values respectively: 1, -1, 2, 0, 0. This will submit successfully, which is incorrect.
Following the change, this will produce an error and not submit.