When creating an author without last name
Then validation should fail
Hints
Author data should only be added to the system if it reaches a certain quality.
Especially, every author should have a last name, that is also not just an empty string.
These checks are called 'validations' in Ruby on Rails.
For the tests, the be_valid matcher can be used to test if a model instance passes all validations:
expect(@author).to_not be_valid
What do you think is the correct place to test this behavior, is it a model or a feature test?
You can learn about validations in this part 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
Scenario
When creating an author without last name Then validation should fail
Hints
Author data should only be added to the system if it reaches a certain quality. Especially, every author should have a last name, that is also not just an empty string. These checks are called 'validations' in Ruby on Rails.
For the tests, the
be_valid
matcher can be used to test if a model instance passes all validations:expect(@author).to_not be_valid
What do you think is the correct place to test this behavior, is it a model or a feature test?
You can learn about validations in this part of the guide.
Error
Estimated progress: 38% complete