Permalink
Browse files

Merge pull request #28586 from mtsmfm/override-driver

Make `driven_by` overridable
  • Loading branch information...
eileencodes committed Mar 29, 2017
2 parents c8832ce + 24e0fa7 commit 56f3af4a6b130bd9ebb86c97a34fcc5135793f70
@@ -87,7 +87,7 @@ class SystemTestCase < IntegrationTest
def initialize(*) # :nodoc:
super
self.class.superclass.driver.use
self.class.driver.use
end
def self.start_application # :nodoc:
@@ -100,6 +100,8 @@ def self.start_application # :nodoc:
SystemTesting::Server.new.run
end
class_attribute :driver, instance_accessor: false
# System Test configuration options
#
# The default settings are Selenium, using Chrome, with a screen size
@@ -113,13 +115,10 @@ def self.start_application # :nodoc:
#
# driven_by :selenium, screen_size: [800, 800]
def self.driven_by(driver, using: :chrome, screen_size: [1400, 1400], options: {})
@driver = SystemTesting::Driver.new(driver, using: using, screen_size: screen_size, options: options)
self.driver = SystemTesting::Driver.new(driver, using: using, screen_size: screen_size, options: options)
end
# Returns the driver object for the initialized system test
def self.driver
@driver ||= SystemTestCase.driven_by(:selenium)
end
driven_by :selenium
end
SystemTestCase.start_application
@@ -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

0 comments on commit 56f3af4

Please sign in to comment.