test/unit/connection_tests.rb in sanford-protocol-0.5.4 vs test/unit/connection_tests.rb in sanford-protocol-0.5.5

- old
+ new

@@ -10,11 +10,11 @@ @socket = FakeSocket.new(@msg) @connection = Sanford::Protocol::Connection.new(@socket) end subject{ @connection } - should have_instance_methods :read, :write, :close, :peek + should have_instance_methods :read, :write, :close, :peek, :close_write should "read messages off the socket with #read" do assert_equal @data, subject.read end @@ -28,9 +28,14 @@ assert @socket.closed? end should "look at the first byte of data on the socket with #peek" do assert_equal @socket.in[0, 1], subject.peek + end + + should "close the write stream of the socket with #close_write" do + subject.close_write + assert @socket.write_stream_closed? end end class RealConnectionTests < BaseTests