Sha256: 377731a4198dce57d40c86f5e2d3598d4aa038946af319a07798b55a4a2567fe

Contents?: true

Size: 654 Bytes

Versions: 5

Compression:

Stored size: 654 Bytes

Contents

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), "spec_common"))
require 'bindata/skip'

describe BinData::Skip do
  subject { BinData::Skip.new(:length => 5) }
  let(:io) { StringIO.new("abcdefghij") }

  it { should == "" }
  its(:to_binary_s) { should == "\000" * 5 }

  it "skips bytes" do
    subject.read(io)
    io.pos.should == 5
  end

  it "has expected binary representation after setting value" do
    subject.assign("123")
    subject.to_binary_s.should == "\000" * 5
  end

  it "has expected binary representation after reading" do
    subject.read(io)
    subject.to_binary_s.should == "\000" * 5
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
jbangert-bindata-1.5.0 spec/skip_spec.rb
bindata-1.5.1 spec/skip_spec.rb
bindata-1.5.0 spec/skip_spec.rb
bindata-1.4.5 spec/skip_spec.rb
bindata-1.4.4 spec/skip_spec.rb