aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/system_testing/driver_adapter.rb
blob: ccd702e96766936bcde2778eb7a7e25169420d13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require "system_testing/driver_adapters"

module SystemTesting
  # The <tt>SystemTesting::DriverAdapter</tt> module is used to load the driver
  # set in your Rails' test configuration file.
  #
  # The default driver adapter is the +:rails_selenium_driver+.
  module DriverAdapter
    extend ActiveSupport::Concern

    module ClassMethods
      def default_driver # :nodoc
        :rails_selenium_driver
      end

      # Returns the current driver that is set. If no driver is set in the
      # Rails' configuration file then +:rails_selenium_driver+ will be
      # initialized.
      def driver
        @driver ||= DriverAdapters.lookup(default_driver)
      end

      # Specify the adapter and settings for the system test driver set in the
      # Rails' configuration file.
      def driver=(driver)
        @driver = DriverAdapters.lookup(driver)
        @driver.call
      end
    end
  end
end