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.



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

#appObject (readonly)

Returns the value of attribute app.



22
23
24
# File 'lib/capybara/server.rb', line 22

def app
  @app
end

#portObject (readonly)

Returns the value of attribute port.



22
23
24
# File 'lib/capybara/server.rb', line 22

def port
  @port
end

Instance Method Details

#hostObject



30
31
32
# File 'lib/capybara/server.rb', line 30

def host
  'localhost'
end

#responsive?Boolean

Returns:

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