Validations
28 Jun 2016
Reading time ~1 minute
What I Did
- Addressed final comments for
activation
branch PR including some validation business, unnecessary methods, etc. - Intern Group Meeting: Wire-frames Sketching
- Spent the rest of the day familiarizing myself with “shoulda-matchers” RSpec matchers and fleshed out essential model unit tests.
What I Learned
- The biggest thing I learned is what essentially lays under the hood for every RSpec matcher that
shoulda-matchers
provides. That is, most tests will more or less do the following- Create a record
- Update the record to an invalid state
- Run validations
- Ensure that the generated error messages in fact includes specific error.
- Update the record to a valid state
- Run validations
- Ensure that the generated error messages in fact does not include those specific errors.
- Validations ought to be triple check with control structures in controllers especially to ensure updates are valid.
What I Still Don’t Understand
- Should I validate attributes for models that are not available to visitors or users in form fields of view files? Is it necessary to check my own app’s logic in this way?
- Still not entirely clear what the effect of a
db:rollback
vs dropping a database entirely.
What I’d Like To Learn
- I’ve been inserting
<br>
tags in place of properly structuring my view files, which I must address ASAP.