aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_testing
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/system_testing')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/server.rb9
-rw-r--r--actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb20
2 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/server.rb b/actionpack/lib/action_dispatch/system_testing/server.rb
index 62ba07736b..4a214ef713 100644
--- a/actionpack/lib/action_dispatch/system_testing/server.rb
+++ b/actionpack/lib/action_dispatch/system_testing/server.rb
@@ -16,8 +16,17 @@ module ActionDispatch
end
def setup
+ set_server
+ set_port
+ end
+
+ def set_server
Capybara.server = :rails_puma
end
+
+ def set_port
+ Capybara.always_include_port = true
+ end
end
end
end
diff --git a/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb b/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb
new file mode 100644
index 0000000000..491559eedf
--- /dev/null
+++ b/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb
@@ -0,0 +1,20 @@
+module ActionDispatch
+ module SystemTesting
+ module TestHelpers
+ module SetupAndTeardown # :nodoc:
+ DEFAULT_HOST = "127.0.0.1"
+
+ def before_setup
+ host! DEFAULT_HOST
+ super
+ end
+
+ def after_teardown
+ super
+ take_failed_screenshot
+ Capybara.reset_sessions!
+ end
+ end
+ end
+ end
+end