###Q1 // Create a new Rails application called model_tdd. Add rspec_rails to the Gemfile. Install RSpec.
$ rails new model_tdd
# Gemfile
group :development, :test do
gem "rspec-rails"
end
$ bundle exec rails generate rspec:install
###Q2 // Create a User model with an email attribute.
$ rails g model User email
$ rake db:migrate
###Q3 // Add a test to make sure that the email attribute is populated when a User record is created.
# spec/models/user_spec.rb
it "is invalid without an email" do
expect(User.new(email: nil)).to have(1).errors_on(:email)
end
###Q4 // (Verify that the test is failing by running $ bundle exec rspec spec/models/user_spec.rb) Write some code to make the test pass.
# app/models/user.rb
validates :email, presence: true