swt2-intro-exercise / rails-exercise-20-Antonius

rails-exercise-20-BlueIceshard created by GitHub Classroom
MIT License
0 stars 0 forks source link

New author page should show validation errors #8

Closed swt2public closed 3 years ago

swt2public commented 3 years ago

Scenario

Given users visit the new author page And fills in only first name and homepage, and NOT the last name When they click submit Then the page should 'error' and what went wrong

Hints

Validation errors should be communicated to the user.

These are stored in the errors attribute of model instances. It can be checked (@author.errors.any?) and can be iterated over to extract error details (@author.errors.full_messages.each). Adding this type of code also requires modifying the new action of the AuthorsController.

Your test can try to create an invalid object (on the new author page) and check whether 'error' is displayed.

Here is the relevant section of the guide.

Error

Expected to find text matching /error/i in "all authors\nname homepage\nnew"

15/44 exercise tests have passed