From 003fbfefbd0484f33fd2f0598cb32d7774a2a151 Mon Sep 17 00:00:00 2001 From: Michael Dupuis Jr Date: Mon, 22 Sep 2014 20:02:54 -0400 Subject: [PATCH] Updates README with information about specifying test host. --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 05e06da..729da1d 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,28 @@ The `current_email` method will delegate all necessary method calls to current_email.subject` ``` +## Setting your test host +When testing, it's common to want to open an email and click through to your +application. To do this, you'll probably need to update your test +environment, as well as Capybara's configuration. + +By default, Capybara's `app_host` is set to +`http://example.com.` You should update this so that it points to the +same host as your test environment. In our example, we'll update both to +`http://localhost/3001`: + +```ruby +# tests/test_helper.rb +ActionDispatch::IntegrationTest + Capybara.server_port = 3001 + Capybara.app_host = 'http://localhost/3001' +end + +# config/environments/test.rb +config.action_mailer.default_url_options = { host: 'localhost', port: +3000 } +``` + Check out API for the `mail` gem for details on what methods are available.