Class: Capybara::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/server.rb

Defined Under Namespace

Classes: Identify

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#appObject (readonly)

Returns the value of attribute app.



25
26
27
# File 'lib/capybara/server.rb', line 25

def app
  @app
end

#portObject (readonly)

Returns the value of attribute port.



25
26
27
# File 'lib/capybara/server.rb', line 25

def port
  @port
end

Instance Method Details

#hostObject



33
34
35
# File 'lib/capybara/server.rb', line 33

def host
  'localhost'
end

#responsive?Boolean

Returns:

  • (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