Class: Capybara::Driver::Terminus
- Inherits:
-
Base
- Object
- Base
- Capybara::Driver::Terminus
- Extended by:
- Forwardable
- Defined in:
- lib/capybara/driver/terminus.rb
Constant Summary collapse
- NULL_APP =
lambda do |env| [200, {'Content-Type' => 'text/html'}, ['']] end
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #find(xpath) ⇒ Object
-
#initialize(app = nil, options = {}) ⇒ Terminus
constructor
A new instance of Terminus.
- #invalid_element_errors ⇒ Object
- #needs_server? ⇒ Boolean
- #visit(path) ⇒ Object
- #wait? ⇒ Boolean
- #within_window(name) ⇒ Object (also: #within_frame)
Constructor Details
#initialize(app = nil, options = {}) ⇒ Terminus
Returns a new instance of Terminus.
8 9 10 11 12 13 14 15 16 |
# File 'lib/capybara/driver/terminus.rb', line 8 def initialize(app = nil, = {}) @app = Terminus::Proxy[app || NULL_APP] @options = @rack_server = Capybara::Server.new(@app) @rack_server.boot sleep(0.1) until Terminus.server_running?(@rack_server) Terminus.register_local_port(@rack_server.port) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/capybara/driver/terminus.rb', line 2 def @options end |
Instance Method Details
#find(xpath) ⇒ Object
18 19 20 |
# File 'lib/capybara/driver/terminus.rb', line 18 def find(xpath) browser.find(xpath, self) end |
#invalid_element_errors ⇒ Object
22 23 24 |
# File 'lib/capybara/driver/terminus.rb', line 22 def invalid_element_errors [::Terminus::ObsoleteElementError] end |
#needs_server? ⇒ Boolean
26 27 28 |
# File 'lib/capybara/driver/terminus.rb', line 26 def needs_server? true end |
#visit(path) ⇒ Object
30 31 32 33 34 |
# File 'lib/capybara/driver/terminus.rb', line 30 def visit(path) h, s = Capybara.app_host, @rack_server path = "#{h || "http://#{s.host}:#{s.port}"}#{path}" unless path =~ /^https?:\/\// browser.visit(path) end |
#wait? ⇒ Boolean
36 37 38 |
# File 'lib/capybara/driver/terminus.rb', line 36 def wait? true end |