swt2-intro-exercise / rails-exercise-18-lassesteffen

rails-exercise-18-lassesteffen created by GitHub Classroom
MIT License
0 stars 0 forks source link

Author should not validate without last name #7

Closed swt2public closed 5 years ago

swt2public commented 5 years ago

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

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

Estimated progress: 38% complete

swt2public commented 5 years ago

Sorry, it's not working for me yet:

Scenario

When creating an author without last name Then validation should fail

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

If you have problems solving this task, please don't hesitate to contact the teaching team!

swt2public commented 5 years ago

Sorry, it's not working for me yet:

Scenario

When creating an author without last name Then validation should fail

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

If you have problems solving this task, please don't hesitate to contact the teaching team!

swt2public commented 5 years ago

Sorry, it's not working for me yet:

Scenario

When creating an author without last name Then validation should fail

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

If you have problems solving this task, please don't hesitate to contact the teaching team!