Validate presence of :name (assures not blank)
Once validation added to :name, Add 2 tests: 1. That :name is valid, and 2. In test, populate @user.name with blank data (eg @user.name = ' ') and tests if 'presence' is true (in this case, the data is NOT PRESENT, ie, empty) so the test passes because @user.name = ' ' *should_not be_valid*)
Last 2 tests tested 1. That is DOES validate :name and 2. (seperately) that it checks that the data passed in (eg @user.name = ' ' ) is not blank or whitespace, 'validate presence' (implying that the data is present).
Add (failing) test to see that blank data for email is not_valid
Added validation of presence to user.rb 'validates(:email, presence: true)', now test passes, it 'does validate that blank data ' ' entered, is not_valid.
Added validation of presence to user.rb 'validates(:email, presence: true)', now test passes, it 'does validate that blank data ' ' entered, is not_valid.
test and validation for max length of :name
comment added to clarify 'it {should be_valid}', which merely 'verifies that the subject (@user) is initially valid'.
tests and validation for: 1. email format (using regex) 2. uniqueness: 2a. via uniqueness validator 2b. via db index (rails migration to add index, assure uniqueness in index before allowing second submission)
password confirmation. tests and validations.
Ch6 complete. First user created (locally) using the rails console to confirm it is working.