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.
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
13 exercise tests have passed. There are 44 in total. You will solve multiple at once towards the end.