spec/base_primitive_spec.rb in bindata-0.11.1 vs spec/base_primitive_spec.rb in bindata-1.0.0
- old
+ new
@@ -34,14 +34,14 @@
data.should_not be_in_read
data.value.should == 5
end
it "should conform to rule 2 for returning a value" do
- io = StringIO.new([42].pack("V"))
+ io = BinData::IO.new([42].pack("V"))
data = ExampleSingle.new(:value => 5)
data.expose_methods_for_testing
- data.do_read(BinData::IO.new(io))
+ data.do_read(io)
data.should be_in_read
data.value.should == 42
end
it "should conform to rule 3 for returning a value" do
@@ -216,18 +216,18 @@
it "should return that :value" do
@data.value.should == 5
end
it "should change during reading" do
- io = StringIO.new([56].pack("V"))
- @data.do_read(BinData::IO.new(io))
+ io = BinData::IO.new([56].pack("V"))
+ @data.do_read(io)
@data.value.should == 56
@data.done_read
end
it "should not change after reading" do
- io = StringIO.new([56].pack("V"))
+ io = BinData::IO.new([56].pack("V"))
@data.read(io)
@data.value.should == 5
end
it "should not be able to change the value" do
@@ -236,10 +236,10 @@
end
end
describe BinData::BasePrimitive, "with :check_value" do
before(:each) do
- @io = StringIO.new([34].pack("V"))
+ @io = BinData::IO.new([34].pack("V"))
end
it "should succeed when check_value is non boolean and correct" do
data = ExampleSingle.new(:check_value => 34)
lambda { data.read(@io) }.should_not raise_error