swt2-intro-exercise / rails-exercise-20-sirkrypt0

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

Author should not validate without last name #7

Closed swt2public closed 4 years ago

swt2public commented 4 years ago

Scenario

When creating an author without last name Then validation should fail

Hints

Author data should pass checks, i.e. validations in Ruby on Rails, before being saved. In particular, an author's last name should not be an empty string.

In your test for this behavior, be_valid can be used to test if a model instance passes validations: expect(@author).to_not be_valid

Here is the relevant section of the guide.

Error

Expected #<author id: nil, first_name: "alan", last_name: nil, homepage: "http://example.com", created_at: nil, updated_at: nil> not to be valid

13/44 exercise tests have passed