Generate User model with 'rails generate model User name:string email:string'
Initial test case for user model which will pass
Be sure to run 'bundle exec rake test:prepare' before you run 'rspec spec' or 'rake spec'
Validating presence: A failing test for validation of the name attribute
Validating presence: get the test on name attribute to pass
Validating presence: email attribute
Length validation: a failing test for name <= 50 characters
Length validation: Adding a length validation for the name attribute
Format validation: A failing test for email format
Format validation: Validating the email format with a regular expression
Uniqueness validation: a failing test for the rejection of duplicated email addresses
Uniqueness validation: Validating the uniqueness of email addresses
Uniqueness validation: A failing test for the rejection of duplicate email addresses, insensitive to case
Uniqueness validation: Validating the uniqueness of email addresses, ignoring case
However duplicated email address will still happen in race conditions
Concurrent uniqueness validation: Add unique index on email. We
run 'rails generate migration add_index_to_users_email' and
add code 'add_index(...)' to it and
run 'bundle exec rake db:migrate'
Concurrent uniqueness validation: Use 'before_save' callback to ensure email uniqueness by downcasing the email attribute
A hashed password: Adding bcrypt-ruby to the Gemfile
A hashed password: a failing test ensuring that a User object has a password_digest column
A hashed password: The migration to add a password_digest column to the users table
We ran 'rails generate migration add_password_digest_to_users password_digest:string' to generate the migration script
The '_to_users' convention will automatically insert 'add_columns(...)' for users table into the script
Ran 'rake db:migrate' 'rake test:prepare' to get the rspec green
Password and confirmation: Testing for the password and password_confirmation attributes
Password and confirmation: Testing blank password should not be valid
All test case will fail because we don't implement attribute to user model yet