swt2-intro-exercise / rails-intro-21-YoungBinKo

rails-intro-21-YoungBinKo created by GitHub Classroom
MIT License
0 stars 0 forks source link

Author should not validate without last name #8

Open swt2public opened 2 years ago

swt2public commented 2 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 (5.10) of the Rails 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 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.