Sha256: 66d1692d296c5e9eb1ccf8d8f85b6ffde56512e8b0388137ebd9a3d34c707ccb
Contents?: true
Size: 892 Bytes
Versions: 5
Compression:
Stored size: 892 Bytes
Contents
#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), "spec_common")) require 'bindata/count_bytes_remaining' describe BinData::CountBytesRemaining do it { should == 0 } its(:num_bytes) { should be_zero } it "counts till end of stream" do data = "abcdefghij" subject.read(data).should == 10 end it "does not read any data" do io = StringIO.new "abcdefghij" subject.read(io) io.pos.should == 0 end it "does not write any data" do subject.to_binary_s.should == "" end it "allows setting value for completeness" do subject.assign("123") subject.should == "123" subject.to_binary_s.should == "" end it "accepts BinData::BasePrimitive parameters" do count = BinData::CountBytesRemaining.new(:check_value => 2) expect { count.read("xyz") }.to raise_error(BinData::ValidityError) end end
Version data entries
5 entries across 5 versions & 2 rubygems