Class: CypressRails::Server
- Inherits:
-
Object
- Object
- CypressRails::Server
- Extended by:
- Forwardable
- Defined in:
- lib/cypress_rails/server.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#healthcheck_url ⇒ Object
readonly
Returns the value of attribute healthcheck_url.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#log_path ⇒ Object
readonly
Returns the value of attribute log_path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host, command, healthcheck_url, log_path) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(host, command, healthcheck_url, log_path) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 |
# File 'lib/cypress_rails/server.rb', line 12 def initialize(host, command, healthcheck_url, log_path) @host = host @port = find_free_port @command = command @healthcheck_url = URI(healthcheck_url || "http://#{host}").tap { |uri| uri.port = port } @log_path = log_path end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
10 11 12 |
# File 'lib/cypress_rails/server.rb', line 10 def command @command end |
#healthcheck_url ⇒ Object (readonly)
Returns the value of attribute healthcheck_url.
10 11 12 |
# File 'lib/cypress_rails/server.rb', line 10 def healthcheck_url @healthcheck_url end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
10 11 12 |
# File 'lib/cypress_rails/server.rb', line 10 def host @host end |
#log_path ⇒ Object (readonly)
Returns the value of attribute log_path.
10 11 12 |
# File 'lib/cypress_rails/server.rb', line 10 def log_path @log_path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/cypress_rails/server.rb', line 10 def port @port end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cypress_rails/server.rb', line 20 def start spawn_server until server_responsive? puts "Pinging #{healthcheck_url.to_s}..." sleep 1 end yield(host, port) if block_given? ensure stop_server end |