diff options
author | eileencodes <eileencodes@gmail.com> | 2016-09-11 13:33:52 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2017-02-20 15:07:32 -0500 |
commit | 4533bb7dcbdd6e0451395bc869d6c3603c6ff1df (patch) | |
tree | b2d9713b238e96b982fad96107f0749eee22d930 /actionpack | |
parent | d63cfa2738520392ec37b2f77302a6f9f6df1618 (diff) | |
download | rails-4533bb7dcbdd6e0451395bc869d6c3603c6ff1df.tar.gz rails-4533bb7dcbdd6e0451395bc869d6c3603c6ff1df.tar.bz2 rails-4533bb7dcbdd6e0451395bc869d6c3603c6ff1df.zip |
Fix Railtie to pass class when setting options
This will clean up the railtie quite a bit, rather than passing a set of
hash keys call the new class directly like we do with ActiveJob.
Only call driver once when tests start rather than in every single test
setup. This is more performant, and the other way was creating
unnecessary calls.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/system_testing/driver_adapter.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/system_testing/railtie.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/system_testing/test_helper.rb | 5 |
3 files changed, 12 insertions, 8 deletions
diff --git a/actionpack/lib/system_testing/driver_adapter.rb b/actionpack/lib/system_testing/driver_adapter.rb index 3958fa4559..47d37a26b7 100644 --- a/actionpack/lib/system_testing/driver_adapter.rb +++ b/actionpack/lib/system_testing/driver_adapter.rb @@ -13,8 +13,15 @@ module SystemTesting @driver ||= DriverAdapters.lookup(default_driver).new end - def driver=(adapter: default_driver, settings: {}) - @driver = DriverAdapters.lookup(adapter).new(settings) + def driver=(adapter) + @driver = case adapter + when Symbol + DriverAdapters.lookup(adapter).new + else + adapter + end + + @driver.call end end end diff --git a/actionpack/lib/system_testing/railtie.rb b/actionpack/lib/system_testing/railtie.rb index f77184ad3d..6c1ddf1448 100644 --- a/actionpack/lib/system_testing/railtie.rb +++ b/actionpack/lib/system_testing/railtie.rb @@ -1,10 +1,12 @@ +require 'system_test_case' + module SystemTesting class Railtie < Rails::Railtie config.system_testing = ActiveSupport::OrderedOptions.new initializer "system_testing.set_configs" do |app| options = app.config.system_testing - options.driver ||= {} + options.driver ||= Rails::SystemTestCase.default_driver ActiveSupport.on_load(:system_testing) do options.each { |k,v| send("#{k}=", v) } diff --git a/actionpack/lib/system_testing/test_helper.rb b/actionpack/lib/system_testing/test_helper.rb index bbf4e469ac..9f2778919c 100644 --- a/actionpack/lib/system_testing/test_helper.rb +++ b/actionpack/lib/system_testing/test_helper.rb @@ -13,11 +13,6 @@ module SystemTesting end end - def before_setup - Base.driver.call - super - end - def after_teardown Capybara.reset_sessions! super |