Sha256: 503d8319c6e36de4e965fc2fd5536d63bdd2acef737b0706efa41a7fccb1441d
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require File.join(File.dirname(__FILE__), 'spec_helper') describe "Ping" do before do @httping = Ping.new @httping.uri = URI.parse("http://www.example.com/") @httping.format = :interactive @httping.count = 10 end after(:each) do Output.clear end context ".ping" do it "pings the configured url and outputs statistics" do @httping.ping Output.to_s.should match(/10 bytes from http:\/\/www.example.com\/: code=200 msg=OK time=[0-9] msecs/) end end context ".count_reached?" do it "returns false if a host has not yet been pinged the number of times requested" do 2.times { @httping.ping } @httping.should_not be_count_reached end it "returns true if a host has been pinged the number of times requested" do 10.times { @httping.ping } @httping.should be_count_reached end end context ".results" do before do 5.times { @httping.ping } end it "outputs a summary of the pings" do @httping.results Output.to_s.should match(/-- http:\/\/www.example.com\/ httping.rb statistics ---\n5 GETs transmitted\n/) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
httping-1.0.0 | spec/ping_spec.rb |