spec/stringz_spec.rb in bindata-1.1.0 vs spec/stringz_spec.rb in bindata-1.2.0

- old
+ new

@@ -47,26 +47,26 @@ it "should stop at the first zero byte" do io = StringIO.new("abcd\0xyz\0") @str.read(io) @str.value.should == "abcd" - io.read(1).should == "x" + io.pos.should == 5 end it "should handle a zero length string" do io = StringIO.new("\0abcd") @str.read(io) @str.value.should == "" - io.read(1).should == "a" + io.pos.should == 1 end it "should fail if no zero byte is found" do lambda {@str.read("abcd") }.should raise_error(EOFError) end end -describe BinData::Stringz, " when setting the value" do +describe BinData::Stringz, "when setting the value" do before(:each) do @str = BinData::Stringz.new end it "should include the zero byte in num_bytes total" do @@ -114,10 +114,10 @@ it "should read no more than max_length" do io = StringIO.new("abcdefg\0xyz") @str.read(io) @str.value.should == "abcd" - io.read(1).should == "f" + io.pos.should == 5 end it "should accept values less than max_length" do @str.value = "abc" @str.value.should == "abc"