Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f55fe0bd91
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (31 sloc) 0.849 kb
require 'test_helper'
describe Outpost::Scouts::Tcp do
it "should set the time of ping in milliseconds" do
cls = Class.new do
def initialize(host, port, timeout)
end
def duration
0.01
end
def ping?
true
end
end
config = config_stub(:port => 9595, :pinger => cls)
subject = Outpost::Scouts::Tcp.new "test", config
subject.execute
assert subject.response_time.to_i < 100
end
it "should set the time to nil when it fails" do
#nothing uses this port by deafult
config = config_stub(:port => 16)
subject = Outpost::Scouts::Tcp.new "test", config
subject.execute
assert subject.response_time.nil?
end
private
def config_stub(options={})
options = {:host => 'localhost'}.merge options
build_stub(:options => options)
end
end
Jump to Line
Something went wrong with that request. Please try again.