Module: Cuukie::Client

Defined in:
lib/cuukie/client.rb

Instance Method Summary collapse

Instance Method Details

#ping_at(port) ⇒ Object



5
6
7
# File 'lib/cuukie/client.rb', line 5

def ping_at(port)
  RestClient.get "http://localhost:#{port}/ping"
end

#stop_server_at(port) ⇒ Object



18
19
20
21
22
# File 'lib/cuukie/client.rb', line 18

def stop_server_at(port)
  # the server dies without replying, so we expect an error here
  RestClient.delete "http://localhost:#{port}/"
rescue
end

#wait_for_server_at(port) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/cuukie/client.rb', line 9

def wait_for_server_at(port)
  loop do
    begin
      ping_at port
      return
    rescue; end
  end
end