aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/system_testing
diff options
context:
space:
mode:
authorFumiaki MATSUSHIMA <mtsmfm@gmail.com>2017-03-27 21:13:44 +0900
committerFumiaki MATSUSHIMA <mtsmfm@gmail.com>2017-03-29 09:04:30 +0900
commit24e0fa7c4ab81f6c2fb2b3af90ee217620f30d17 (patch)
treed1fae49114ece7ecfc6d81635485e6af724f2601 /actionpack/test/dispatch/system_testing
parent5ac89b168b049e895cc26db90fe54ee77b63bcbc (diff)
downloadrails-24e0fa7c4ab81f6c2fb2b3af90ee217620f30d17.tar.gz
rails-24e0fa7c4ab81f6c2fb2b3af90ee217620f30d17.tar.bz2
rails-24e0fa7c4ab81f6c2fb2b3af90ee217620f30d17.zip
Make `driven_by` overridable
Sometimes we want to use rack_test partially instead of selenium for test speed: ```ruby class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400], options: {url: "http://chrome:4444/wd/hub"} end class WithJavaScriptTest < ApplicationSystemTestCase end class WithoutJavaScriptTest < ApplicationSystemTestCase driven_by :rack_test end ``` In the abobe case, `WithoutJavaScriptTest` uses selenium because `SystemTestCase` calls superclass' driver on `#initialize` (`self.class.superclass.driver.use`). Using `class_attribute` can handle inherited `driven_by`.
Diffstat (limited to 'actionpack/test/dispatch/system_testing')
-rw-r--r--actionpack/test/dispatch/system_testing/system_test_case_test.rb8
1 files changed, 8 insertions, 0 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 1a9421c098..33d98f924f 100644
--- a/actionpack/test/dispatch/system_testing/system_test_case_test.rb
+++ b/actionpack/test/dispatch/system_testing/system_test_case_test.rb
@@ -6,6 +6,14 @@ class SetDriverToRackTestTest < DrivenByRackTest
end
end
+class OverrideSeleniumSubclassToRackTestTest < DrivenBySeleniumWithChrome
+ driven_by :rack_test
+
+ test "uses rack_test" do
+ assert_equal :rack_test, Capybara.current_driver
+ end
+end
+
class SetDriverToSeleniumTest < DrivenBySeleniumWithChrome
test "uses selenium" do
assert_equal :selenium, Capybara.current_driver