diff options
-rw-r--r-- | actionpack/lib/system_testing/driver_adapter.rb | 13 | ||||
-rw-r--r-- | actionpack/lib/system_testing/railtie.rb | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/actionpack/lib/system_testing/driver_adapter.rb b/actionpack/lib/system_testing/driver_adapter.rb index 6d94582395..3958fa4559 100644 --- a/actionpack/lib/system_testing/driver_adapter.rb +++ b/actionpack/lib/system_testing/driver_adapter.rb @@ -5,11 +5,16 @@ module SystemTesting extend ActiveSupport::Concern module ClassMethods - attr_accessor :driver_adapter + def default_driver + :capybara_rack_test_driver + end + + def driver + @driver ||= DriverAdapters.lookup(default_driver).new + end - def driver_adapter=(driver_name_or_class) - driver = DriverAdapters.lookup(driver_name_or_class).new - driver.call + def driver=(adapter: default_driver, settings: {}) + @driver = DriverAdapters.lookup(adapter).new(settings) end end end diff --git a/actionpack/lib/system_testing/railtie.rb b/actionpack/lib/system_testing/railtie.rb index aa3df29344..f77184ad3d 100644 --- a/actionpack/lib/system_testing/railtie.rb +++ b/actionpack/lib/system_testing/railtie.rb @@ -4,7 +4,7 @@ module SystemTesting initializer "system_testing.set_configs" do |app| options = app.config.system_testing - options.driver_adapter ||= :capybara_rack_test_driver + options.driver ||= {} ActiveSupport.on_load(:system_testing) do options.each { |k,v| send("#{k}=", v) } |