Sha256: cb811b21a5e8694e8cfa27a46aab5bb4334ffcc2b7a06f6e9c0fa8d65b367ee8
Contents?: true
Size: 1.33 KB
Versions: 4
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' describe LitmusPaper::Dependency::TCP do before(:all) do @server = TCPServer.new 3333 end after(:all) do @server.close end describe "#available?" do it "is true when it's able to reach the ip and port" do check = LitmusPaper::Dependency::TCP.new("127.0.0.1", 3333) check.should be_available end it "is false when the ip is not available" do check = LitmusPaper::Dependency::TCP.new("10.254.254.254", 3333) check.should_not be_available end it "is false when the port is not available" do check = LitmusPaper::Dependency::TCP.new("127.0.0.1", 3334) check.should_not be_available end it "is false when the request times out" do TCPSocket.stub(:new) do sleep(5) end check = LitmusPaper::Dependency::TCP.new("127.0.0.1", 3334, :timeout_seconds => 1) check.should_not be_available end it "logs exceptions and returns false" do check = LitmusPaper::Dependency::TCP.new("127.0.0.1", 3334) LitmusPaper.logger.should_receive(:info) check.should_not be_available end end describe "to_s" do it "is the name of the class and the ip and port" do check = LitmusPaper::Dependency::TCP.new("127.0.0.1", 3333) check.to_s.should == "Dependency::TCP(tcp://127.0.0.1:3333)" end end end
Version data entries
4 entries across 4 versions & 1 rubygems