test/outpost/scouts/tcp_test.rb in outpost-0.2.4 vs test/outpost/scouts/tcp_test.rb in outpost-0.2.5
- old
+ new
@@ -1,17 +1,26 @@
require 'test_helper'
describe Outpost::Scouts::Tcp do
it "should set the time of ping in milliseconds" do
- @server = Server.new
- @server.boot(TestApp)
- @server.wait_until_booted
+ cls = Class.new do
+ def initialize(host, port, timeout)
+ end
- config = config_stub(:port => 9595)
+ 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 < 100
+ 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)