diff options
author | eileencodes <eileencodes@gmail.com> | 2016-08-27 10:57:08 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2017-02-20 15:07:32 -0500 |
commit | 9edc998d2a5dcaa5898c11bef29c97403941cff5 (patch) | |
tree | dd6fef163b9fb6c6768628adfe4bfef0d1fba8f0 /actionpack/lib/system_testing/driver_adapter.rb | |
parent | fa2b7b03cc82bb40c76c37c91e4663de3ec0a77f (diff) | |
download | rails-9edc998d2a5dcaa5898c11bef29c97403941cff5.tar.gz rails-9edc998d2a5dcaa5898c11bef29c97403941cff5.tar.bz2 rails-9edc998d2a5dcaa5898c11bef29c97403941cff5.zip |
Refactor driver adapter getter/setter
This makes it easier to ask the system test what driver adapter it is
currently using, and makes it easier to change that setting when
necessary.
Diffstat (limited to 'actionpack/lib/system_testing/driver_adapter.rb')
-rw-r--r-- | actionpack/lib/system_testing/driver_adapter.rb | 13 |
1 files changed, 9 insertions, 4 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 |