spec/packet_spec.rb in remcached-0.4.0 vs spec/packet_spec.rb in remcached-0.4.1

- old
+ new

@@ -119,7 +119,25 @@ it "should parse the body correctly" do @pkt[:key].should == "" @pkt[:value].should == "World" end end + + describe :parse_body do + it "should return succeeding bytes" do + s = "\x81\x01\x00\x00" + + "\x00\x00\x00\x00" + + "\x00\x00\x00\x00" + + "\x00\x00\x00\x00" + + "\x00\x00\x00\x00" + + "\x00\x00\x00\x01" + + "chunky bacon" + @pkt = Memcached::Response.parse_header(s[0..23]) + s = @pkt.parse_body(s[24..-1]) + @pkt[:status].should == 0 + @pkt[:total_body_length].should == 0 + @pkt[:value].should == "" + s.should == "chunky bacon" + end + end end end