Class: Quke::DriverRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/quke/driver_registration.rb

Overview

Helper class that contains all methods related to registering drivers with Capybara.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver_config, config) ⇒ DriverRegistration

Instantiate an instance of Quke::DriverRegistration.

It expects an instance of Quke::DriverConfiguration which will detail the driver to be used and any related options, and Quke::Configuration specifically for access to the browserstack config.



26
27
28
29
# File 'lib/quke/driver_registration.rb', line 26

def initialize(driver_config, config)
  @driver_config = driver_config
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Access the instance of Quke::Configuration passed to this instance of Quke::DriverOptions when it was initialized.



19
20
21
# File 'lib/quke/driver_registration.rb', line 19

def config
  @config
end

#driver_configObject (readonly)

Access the instance of Quke::DriverConfiguration passed to this instance of Quke::DriverRegistration when it was initialized.



15
16
17
# File 'lib/quke/driver_registration.rb', line 15

def driver_config
  @driver_config
end

Instance Method Details

#register(driver) ⇒ Object

When called registers with Capybara the driver specified.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/quke/driver_registration.rb', line 32

def register(driver)
  case driver
  when "firefox"
    firefox
  when "chrome"
    chrome
  when "browserstack"
    browserstack
  else
    phantomjs
  end
end