aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2016-08-07 09:01:16 -0400
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:31 -0500
commit0dc63281da1c7075ce63d8dba62e4230d72bfc2a (patch)
treefb849a6ad7e598ad88bc3586572745149a6eb5af /actionpack
parent0056c9b977a4cd61334909ff950de9358ec84d74 (diff)
downloadrails-0dc63281da1c7075ce63d8dba62e4230d72bfc2a.tar.gz
rails-0dc63281da1c7075ce63d8dba62e4230d72bfc2a.tar.bz2
rails-0dc63281da1c7075ce63d8dba62e4230d72bfc2a.zip
Add configuration option for driver adapter
This allows any application to change the driver adapter based on the config settings in the test env.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/system_testing/base.rb2
-rw-r--r--actionpack/lib/system_testing/driver_adapter.rb6
-rw-r--r--actionpack/lib/system_testing/railtie.rb14
3 files changed, 18 insertions, 4 deletions
diff --git a/actionpack/lib/system_testing/base.rb b/actionpack/lib/system_testing/base.rb
index ae4236f97d..770342da82 100644
--- a/actionpack/lib/system_testing/base.rb
+++ b/actionpack/lib/system_testing/base.rb
@@ -5,5 +5,7 @@ module SystemTesting
module Base
include TestHelper
include DriverAdapter
+
+ ActiveSupport.run_load_hooks(:system_testing, self)
end
end
diff --git a/actionpack/lib/system_testing/driver_adapter.rb b/actionpack/lib/system_testing/driver_adapter.rb
index 70c4396323..6d94582395 100644
--- a/actionpack/lib/system_testing/driver_adapter.rb
+++ b/actionpack/lib/system_testing/driver_adapter.rb
@@ -4,11 +4,9 @@ module SystemTesting
module DriverAdapter
extend ActiveSupport::Concern
- included do
- self.driver_adapter = :capybara_rack_test_driver
- end
-
module ClassMethods
+ attr_accessor :driver_adapter
+
def driver_adapter=(driver_name_or_class)
driver = DriverAdapters.lookup(driver_name_or_class).new
driver.call
diff --git a/actionpack/lib/system_testing/railtie.rb b/actionpack/lib/system_testing/railtie.rb
new file mode 100644
index 0000000000..aa3df29344
--- /dev/null
+++ b/actionpack/lib/system_testing/railtie.rb
@@ -0,0 +1,14 @@
+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_adapter ||= :capybara_rack_test_driver
+
+ ActiveSupport.on_load(:system_testing) do
+ options.each { |k,v| send("#{k}=", v) }
+ end
+ end
+ end
+end