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/test | |
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/test')
-rw-r--r-- | actionpack/test/dispatch/system_testing/system_test_case_test.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/actionpack/test/dispatch/system_testing/system_test_case_test.rb b/actionpack/test/dispatch/system_testing/system_test_case_test.rb index a384902a14..ff01d6739a 100644 --- a/actionpack/test/dispatch/system_testing/system_test_case_test.rb +++ b/actionpack/test/dispatch/system_testing/system_test_case_test.rb @@ -1,21 +1,23 @@ require "abstract_unit" -class SystemTestCaseTest < ActiveSupport::TestCase - test "driven_by sets Capybara's default driver to poltergeist" do - ActionDispatch::SystemTestCase.driven_by :poltergeist - - assert_equal :poltergeist, Capybara.default_driver +class DrivenByCaseTestTest < ActiveSupport::TestCase + test "selenium? returns false if driver is poltergeist" do + assert_not ActionDispatch::SystemTestCase.selenium?(:poltergeist) end +end - test "driven_by sets Capybara's drivers respectively" do - ActionDispatch::SystemTestCase.driven_by :selenium, using: :chrome +class DrivenByRackTestTest < ActionDispatch::SystemTestCase + driven_by :rack_test - assert_includes Capybara.drivers, :selenium - assert_includes Capybara.drivers, :chrome - assert_equal :chrome, Capybara.default_driver + test "uses rack_test" do + assert_equal :rack_test, Capybara.current_driver end +end - test "selenium? returns false if driver is poltergeist" do - assert_not ActionDispatch::SystemTestCase.selenium?(:poltergeist) +class DrivenBySeleniumWithChromeTest < ActionDispatch::SystemTestCase + driven_by :selenium, using: :chrome + + test "uses selenium" do + assert_equal :chrome, Capybara.current_driver end end |