Class: Capybara::Server
- Inherits:
-
Object
- Object
- Capybara::Server
- Defined in:
- lib/capybara/server.rb
Defined Under Namespace
Classes: Identify
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(app) ⇒ Server
constructor
A new instance of Server.
- #responsive? ⇒ Boolean
- #url(path) ⇒ Object
Constructor Details
#initialize(app) ⇒ Server
Returns a new instance of Server.
27 28 29 30 31 |
# File 'lib/capybara/server.rb', line 27 def initialize(app) @app = app find_available_port boot end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
25 26 27 |
# File 'lib/capybara/server.rb', line 25 def app @app end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
25 26 27 |
# File 'lib/capybara/server.rb', line 25 def port @port end |
Instance Method Details
#host ⇒ Object
33 34 35 |
# File 'lib/capybara/server.rb', line 33 def host 'localhost' end |
#responsive? ⇒ Boolean
42 43 44 |
# File 'lib/capybara/server.rb', line 42 def responsive? is_running_on_port?(port) end |
#url(path) ⇒ Object
37 38 39 40 |
# File 'lib/capybara/server.rb', line 37 def url(path) path = URI.parse(path).request_uri if path =~ /^http/ "http://#{host}:#{port}#{path}" end |