code and tests for week 5: model validations and controller tests