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/browser.rb13
-rw-r--r--actionpack/lib/action_dispatch/system_testing/driver.rb12
-rw-r--r--actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb2
3 files changed, 13 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/browser.rb b/actionpack/lib/action_dispatch/system_testing/browser.rb
index c9a6628516..14ea06459d 100644
--- a/actionpack/lib/action_dispatch/system_testing/browser.rb
+++ b/actionpack/lib/action_dispatch/system_testing/browser.rb
@@ -1,14 +1,17 @@
+require "action_dispatch/system_testing/driver"
+
module ActionDispatch
module SystemTesting
- class Browser # :nodoc:
+ class Browser < Driver # :nodoc:
def initialize(name, screen_size)
+ super(name)
@name = name
@screen_size = screen_size
end
- def run
+ def use
register
- setup
+ super
end
private
@@ -19,10 +22,6 @@ module ActionDispatch
end
end
end
-
- def setup
- Capybara.default_driver = @name.to_sym
- end
end
end
end
diff --git a/actionpack/lib/action_dispatch/system_testing/driver.rb b/actionpack/lib/action_dispatch/system_testing/driver.rb
index 7c2ad84e19..8decb54419 100644
--- a/actionpack/lib/action_dispatch/system_testing/driver.rb
+++ b/actionpack/lib/action_dispatch/system_testing/driver.rb
@@ -5,14 +5,14 @@ module ActionDispatch
@name = name
end
- def run
- register
+ def use
+ @current = Capybara.current_driver
+ Capybara.current_driver = @name
end
- private
- def register
- Capybara.default_driver = @name
- end
+ def reset
+ Capybara.current_driver = @current
+ 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
index 491559eedf..1c89bfacfa 100644
--- 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
@@ -10,8 +10,8 @@ module ActionDispatch
end
def after_teardown
- super
take_failed_screenshot
+ super
Capybara.reset_sessions!
end
end