spec/primitive_spec.rb in bindata-1.2.1 vs spec/primitive_spec.rb in bindata-1.2.2

- old
+ new

@@ -101,9 +101,18 @@ it "should raise error on missing methods" do lambda { @obj.does_not_exist }.should raise_error(NoMethodError) end + + it "should use read value whilst reading" do + obj = PrimitiveWithEndian.new(:value => 2) + obj.read "\x05\x00" + obj.value.should == 2 + + def obj.reading?; true; end + obj.value.should == 5 + end end describe BinData::Primitive, "requiring custom parameters" do class PrimitiveWithCustom < BinData::Primitive int8 :a, :initial_value => :iv