aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_test_case.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2017-02-19 17:49:21 -0500
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:35 -0500
commit161cf89e134267f9b579f493ca19b12c30d5fd36 (patch)
treeab2228eedae038b15d7684ebf872adf227c75501 /actionpack/lib/action_dispatch/system_test_case.rb
parent983275eb7c01eaeba5798a422514f4d9d6b74786 (diff)
downloadrails-161cf89e134267f9b579f493ca19b12c30d5fd36.tar.gz
rails-161cf89e134267f9b579f493ca19b12c30d5fd36.tar.bz2
rails-161cf89e134267f9b579f493ca19b12c30d5fd36.zip
Fix default host in setup, move teardown to helper file
* Override integration test default host Integration tests automatically set the default host to 'http://example.com'. This works fine for integration tests because they are not real browser sessions, but doesn't work fine for system tests because they are real browser sessions. We can override this by setting the `host!` in `before_setup. The `Capybara.always_include_port` will allow the test to look at `127.0.0.1:port capybara picks` and properly redirect the test. Any application can override this by setting the `host!` in their system test helper. Generally though, applications are going to be using localhost. In this commit I also moved the setup and teardown into their own module for tidiness. * Move teardown settings into system test case These configuration options can be put into the system test case file instead of the generated system tests helper file. This is an implementation detail and therefore shouldn't be generated with the template.
Diffstat (limited to 'actionpack/lib/action_dispatch/system_test_case.rb')
-rw-r--r--actionpack/lib/action_dispatch/system_test_case.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/system_test_case.rb b/actionpack/lib/action_dispatch/system_test_case.rb
index 850f101ca8..91cbc1180c 100644
--- a/actionpack/lib/action_dispatch/system_test_case.rb
+++ b/actionpack/lib/action_dispatch/system_test_case.rb
@@ -4,6 +4,7 @@ require "action_dispatch/system_testing/driver"
require "action_dispatch/system_testing/server"
require "action_dispatch/system_testing/browser"
require "action_dispatch/system_testing/test_helpers/screenshot_helper"
+require "action_dispatch/system_testing/test_helpers/setup_and_teardown"
module ActionDispatch
class SystemTestCase < IntegrationTest
@@ -92,6 +93,7 @@ module ActionDispatch
# and Rails, any driver that is supported by Capybara is supported by system
# tests as long as you include the required gems and files.
include Capybara::DSL
+ include SystemTesting::TestHelpers::SetupAndTeardown
include SystemTesting::TestHelpers::ScreenshotHelper
def self.start_application # :nodoc: