swt2-intro-exercise / rails-exercise-18-Kenneth-Schroeder

rails-exercise-18-Kenneth-Schroeder created by GitHub Classroom
MIT License
1 stars 0 forks source link

New author page should show validation errors #10

Open swt2public opened 5 years ago

swt2public commented 5 years ago

Scenario

Given users visit the new author page And fill in only first name and homepage When they click submit Then the page should show an error reporting what went wrong

Hints

The fact that particular set of data cannot be saved should be communicated to the user. Errors of attempted saves of objects are stored in the errors attribute.

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

Error

Expected to find text matching /error/i in "authors#new\nfind me in app/views/authors/new.html.erb\nfirst name:\nlast name:\nhomepage: http://example.com"

Estimated progress: 44% complete