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.
24 25 26 27 28 |
# File 'lib/capybara/server.rb', line 24 def initialize(app) @app = app find_available_port boot end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
22 23 24 |
# File 'lib/capybara/server.rb', line 22 def app @app end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
22 23 24 |
# File 'lib/capybara/server.rb', line 22 def port @port end |
Instance Method Details
#host ⇒ Object
30 31 32 |
# File 'lib/capybara/server.rb', line 30 def host 'localhost' end |
#responsive? ⇒ Boolean
39 40 41 |
# File 'lib/capybara/server.rb', line 39 def responsive? is_running_on_port?(port) end |
#url(path) ⇒ Object
34 35 36 37 |
# File 'lib/capybara/server.rb', line 34 def url(path) path = URI.parse(path).request_uri if path =~ /^http/ "http://#{host}:#{port}#{path}" end |