Ruby on Rails チュートリアル　27日目

いちから作り直していたらこんなエラーが、、、

```
Running via Spring preloader in process 7079
Run options: --seed 19941

# Running:

.....F...........EE.....................FF....E.............

Finished in 1.784652s, 33.6200 runs/s, 115.4287 assertions/s.

  1) Failure:
UserTest#test_feed_should_have_the_right_posts [/home/ec2-user/environment/sample_app/test/models/user_test.rb:88]:
Expected false to be truthy.

  2) Error:
UserMailerTest#test_account_activation:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
    app/views/user_mailer/account_activation.html.erb:9:in `_app_views_user_mailer_account_activation_html_erb__763926513442743450_47572060'
    app/mailers/user_mailer.rb:5:in `account_activation'
    test/mailers/user_mailer_test.rb:9:in `block in <class:UserMailerTest>'

  3) Error:
UserMailerTest#test_password_reset:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
    app/views/user_mailer/password_reset.html.erb:5:in `_app_views_user_mailer_password_reset_html_erb__2777093095357922761_48906920'
    app/mailers/user_mailer.rb:10:in `password_reset'
    test/mailers/user_mailer_test.rb:21:in `block in <class:UserMailerTest>'

  4) Failure:
FollowingTest#test_following_page [/home/ec2-user/environment/sample_app/test/integration/following_test.rb:13]:
Expected true to be nil or false

  5) Failure:
FollowingTest#test_followers_page [/home/ec2-user/environment/sample_app/test/integration/following_test.rb:22]:
Expected true to be nil or false

  6) Error:
UsersSignupTest#test_valid_signup_information_with_account_activation:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
    app/views/user_mailer/account_activation.html.erb:9:in `_app_views_user_mailer_account_activation_html_erb__763926513442743450_47572060'
    app/mailers/user_mailer.rb:5:in `account_activation'
    app/models/user.rb:60:in `send_activation_email'
    app/controllers/users_controller.rb:23:in `create'
    test/integration/users_signup_test.rb:25:in `block (2 levels) in <class:UsersSignupTest>'
    test/integration/users_signup_test.rb:24:in `block in <class:UsersSignupTest>'

60 runs, 206 assertions, 3 failures, 3 errors, 0 skips
```

とりあえずエラー文を先に直そうと思い、「ActionView::Template::Error: Missing host to link to!」で検索して出たサイトを参考にしてproduction.rbとdevelopment.rbを修正してみましたが、変化はありませんでした。

```production.rb
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  host = 'https://thawing-mesa-83881.herokuapp.com'
  config.action_mailer.default_url_options = { host: host }
  ActionMailer::Base.smtp_settings = {
    :address        => 'smtp.sendgrid.net',
    :port           => '587',
    :authentication => :plain,
    :user_name      => ENV['SENDGRID_USERNAME'],
    :password       => ENV['SENDGRID_PASSWORD'],
    :domain         => 'heroku.com',
    :enable_starttls_auto => true
  }
  
```

```development.rb
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :test
  host = 'f51d0f98f1f241909a9dff226e65cb19.vfs.cloud9.ap-northeast-1.amazonaws.com'
  config.action_mailer.default_url_options = { host: host, protocol: 'https' }
```

他にどこを修正すればうまくいくのでしょうか？