Test BinaryProtocol#read_message_header with bad data


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668978 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/binaryprotocol_spec.rb b/lib/rb/spec/binaryprotocol_spec.rb
index 5820fa9..96bafef 100644
--- a/lib/rb/spec/binaryprotocol_spec.rb
+++ b/lib/rb/spec/binaryprotocol_spec.rb
@@ -175,7 +175,12 @@
       @prot.read_message_begin.should == ['testMessage', MessageTypes::REPLY, 42]
     end
 
-    # message header is a noop
+    it "should raise an exception if the message header has the wrong version" do
+      @prot.should_receive(:read_i32).and_return(42)
+      lambda { @prot.read_message_begin }.should raise_error(ProtocolException, 'Missing version identifier') { |e| e.type == ProtocolException::BAD_VERSION }
+    end
+
+    # message footer is a noop
 
     it "should read a field header" do
       @prot.should_receive(:read_byte).ordered.and_return(Types::STRING)