Permalink
Browse files

Add configuration option for driver adapter

This allows any application to change the driver adapter based on the
config settings in the test env.
  • Loading branch information...
eileencodes committed Aug 7, 2016
1 parent 0056c9b commit 0dc63281da1c7075ce63d8dba62e4230d72bfc2a
@@ -5,5 +5,7 @@ module SystemTesting
module Base
include TestHelper
include DriverAdapter
+
+ ActiveSupport.run_load_hooks(:system_testing, self)
end
end
@@ -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
@@ -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
@@ -9,6 +9,7 @@
action_cable/engine
rails/test_unit/railtie
sprockets/railtie
+ system_testing/railtie
).each do |railtie|
begin
require railtie

0 comments on commit 0dc6328

Please sign in to comment.