Sha256: 2ba3683f483f641affcd5b33277d6b22c3cc82568f5bea8a5bcaa4f48c9c6a7e

Contents?: true

Size: 621 Bytes

Versions: 7

Compression:

Stored size: 621 Bytes

Contents

require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/tell', __FILE__)

describe "StringIO#pos" do
  it_behaves_like :stringio_tell, :pos
end

describe "StringIO#pos=" do
  before(:each) do
    @io = StringIOSpecs.build
  end

  it "updates the current byte offset" do
    @io.pos = 26
    @io.read(1).should == "r"
  end

  it "raises an EINVAL if given a negative argument" do
    lambda { @io.pos = -10 }.should  raise_error(Errno::EINVAL)
  end

  it "updates the current byte offset after reaching EOF" do
    @io.read
    @io.pos = 26
    @io.read(1).should == "r"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubysl-stringio-2.3 spec/pos_spec.rb
rubysl-stringio-2.2 spec/pos_spec.rb
rubysl-stringio-2.1 spec/pos_spec.rb
rubysl-stringio-2.1.0 spec/pos_spec.rb
rubysl-stringio-1.0.1 spec/pos_spec.rb
rubysl-stringio-1.0.0 spec/pos_spec.rb
rubysl-stringio-2.0.0 spec/pos_spec.rb