Class: CapybaraSelenium::Configurator
- Inherits:
-
Object
- Object
- CapybaraSelenium::Configurator
- Includes:
- AppServer, SeleniumServer
- Defined in:
- lib/capybara_selenium.rb
Overview
Class for configuring capybara and selenium in order to instance the desired driver.
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(&block) ⇒ Configurator
constructor
A new instance of Configurator.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Configurator
Returns a new instance of Configurator.
19 20 21 |
# File 'lib/capybara_selenium.rb', line 19 def initialize(&block) define_singleton_method(:dispatch, block) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/capybara_selenium.rb', line 28 def method_missing(method, *args, &block) if method =~ /(.*)_app_server/ @app_server ||= configurator :app_server, $1 elsif method =~ /(.*)_selenium_server/ @selenium_server ||= configurator :selenium_server, $1 else raise end end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
17 18 19 |
# File 'lib/capybara_selenium.rb', line 17 def driver @driver end |
Instance Method Details
#apply ⇒ Object
23 24 25 26 |
# File 'lib/capybara_selenium.rb', line 23 def apply @app_server.apply @driver = @selenium_server.apply end |