Sha256: d6f90f666413dcd354f1bcd40b887084f5463bac83ac4b554d0e5bd339dfd99e
Contents?: true
Size: 956 Bytes
Versions: 3
Compression:
Stored size: 956 Bytes
Contents
require 'spec_helper' require 'whois/server/socket_handler' describe Whois::Server::SocketHandler do describe "#call" do [ Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EPIPE, SocketError ].each do |error| it "re-raises #{error} as Whois::ConnectionError" do expect(subject).to receive(:execute).and_raise(error) expect { subject.call("example.test", "whois.test", 43) }.to raise_error(Whois::ConnectionError, "#{error}: #{error.new.message}") end it "executes a socket connection for given args" do socket = double("Handler") expect(socket).to receive(:write).with("example.test\r\n") expect(socket).to receive(:read) expect(socket).to receive(:close) expect(TCPSocket).to receive(:new).with("whois.test", 43).and_return(socket) subject.call("example.test", "whois.test", 43) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
whois-5.0.1 | spec/whois/server/socket_handler_spec.rb |
whois-5.0.0 | spec/whois/server/socket_handler_spec.rb |
whois-4.1.0 | spec/whois/server/socket_handler_spec.rb |