Class: Capybara::Mechanize::Driver
- Inherits:
-
RackTest::Driver
- Object
- RackTest::Driver
- Capybara::Mechanize::Driver
- Defined in:
- lib/capybara/mechanize/driver.rb
Instance Method Summary collapse
- #browser ⇒ Object
- #configure {|browser.agent| ... } ⇒ Object
-
#initialize(app, **options) ⇒ Driver
constructor
A new instance of Driver.
- #remote?(url) ⇒ Boolean
- #reset! ⇒ Object
Constructor Details
#initialize(app, **options) ⇒ Driver
Returns a new instance of Driver.
6 7 8 9 10 |
# File 'lib/capybara/mechanize/driver.rb', line 6 def initialize(app, **) raise ArgumentError, 'mechanize requires a rack application, but none was given' unless app super end |
Instance Method Details
#browser ⇒ Object
20 21 22 |
# File 'lib/capybara/mechanize/driver.rb', line 20 def browser @browser ||= Capybara::Mechanize::Browser.new(self) end |
#configure {|browser.agent| ... } ⇒ Object
16 17 18 |
# File 'lib/capybara/mechanize/driver.rb', line 16 def configure yield(browser.agent) if block_given? end |
#remote?(url) ⇒ Boolean
12 13 14 |
# File 'lib/capybara/mechanize/driver.rb', line 12 def remote?(url) browser.remote?(url) end |
#reset! ⇒ Object
24 25 26 27 |
# File 'lib/capybara/mechanize/driver.rb', line 24 def reset! @browser.agent.shutdown super end |