diff options
author | Lucas Mazza <lucastmazza@gmail.com> | 2017-02-23 22:48:12 -0300 |
---|---|---|
committer | Lucas Mazza <lucastmazza@gmail.com> | 2017-02-24 13:22:22 -0300 |
commit | 704853b58be60b307261da9b9990a4c87c68860e (patch) | |
tree | c5d4a6fa67a50a6f4427679701794adb6b68061e /actionpack/lib/action_dispatch/system_testing | |
parent | 4ed704740b7ccc8ac9cfb7b5ec62d55ac178ec97 (diff) | |
download | rails-704853b58be60b307261da9b9990a4c87c68860e.tar.gz rails-704853b58be60b307261da9b9990a4c87c68860e.tar.bz2 rails-704853b58be60b307261da9b9990a4c87c68860e.zip |
Change `SystemTestCase.driven_by` to use `setup`/`teardown` hooks
Previously, `driven_by` would change the Capybara configuration when
the test case is loaded, and having multiple test classes with different
`driven_by` configs would fail as the last loaded would be effective.
Diffstat (limited to 'actionpack/lib/action_dispatch/system_testing')
-rw-r--r-- | actionpack/lib/action_dispatch/system_testing/browser.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/system_testing/driver.rb | 12 |
2 files changed, 12 insertions, 13 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 |