1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require File.dirname(__FILE__) + '/fixtures/classes'
3 require File.dirname(__FILE__) + '/shared/pos'
6 it_behaves_like(:io_pos, :pos)
13 File.open @fname, 'w' do |f| f.write "123" end
20 it "sets the offset" do
21 File.open @fname do |f|
24 f.read(1).should == val1
28 it "can handle any numerical argument without breaking" do
29 File.open @fname do |io|
34 io.pos.should == 2**32
36 io.pos = 1.23423423432e12
37 io.pos.should == Integer(1.23423423432e12)
39 io.pos = Float::EPSILON
42 lambda { io.pos = 2**128 }.should raise_error(RangeError)
46 it "raises IOError on closed stream" do
47 lambda { IOSpecs.closed_file.pos = 0 }.should raise_error(IOError)