test/unit/connection_tests.rb in sanford-protocol-0.4.1 vs test/unit/connection_tests.rb in sanford-protocol-0.5.0
- old
+ new
@@ -10,18 +10,23 @@
@socket = FakeSocket.new(@msg)
@connection = Sanford::Protocol::Connection.new(@socket)
end
subject{ @connection }
- should have_instance_methods :read, :write
+ should have_instance_methods :read, :write, :close
should "read messages off the socket with #read" do
assert_equal @data, subject.read
end
should "write messages to the socket with #write" do
subject.write(@data)
assert_equal @msg, @socket.out
+ end
+
+ should "close the socket with #close" do
+ subject.close
+ assert @socket.closed?
end
end
class TimeoutTests < BaseTests
desc "when timing out on a read"