Sha256: 8595984e4db10e3a84b9bcee9b0fc86e34afeead4c74351034a788f0a2b4b196

Contents?: true

Size: 745 Bytes

Versions: 7

Compression:

Stored size: 745 Bytes

Contents

#!/usr/bin/env ruby

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

describe BinData::Rest do
  it "should read till end of stream" do
    data = "abcdefghij"
    BinData::Rest.read(data).should == data
  end

  it "should default to the empty string" do
    BinData::Rest.new.value.should == ""
  end

  it "should allow setting value for completeness" do
    rest = BinData::Rest.new
    rest.value = "123"
    rest.value.should == "123"
    rest.to_binary_s.should == "123"
  end

  it "should accept BinData::BasePrimitive parameters" do
    rest = BinData::Rest.new(:check_value => "abc")
    lambda {
      rest.read("abc")
    }.should_not raise_error(BinData::ValidityError)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bindata-1.2.2 spec/rest_spec.rb
bindata-1.2.1 spec/rest_spec.rb
bindata-1.2.0 spec/rest_spec.rb
bindata-1.1.0 spec/rest_spec.rb
bindata-1.0.0 spec/rest_spec.rb
bindata-0.11.1 spec/rest_spec.rb
bindata-0.11.0 spec/rest_spec.rb