diff options
Diffstat (limited to 'spec/ruby/library/stringio/pos_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringio/pos_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/ruby/library/stringio/pos_spec.rb b/spec/ruby/library/stringio/pos_spec.rb index 59d0a43f12..16f068b049 100644 --- a/spec/ruby/library/stringio/pos_spec.rb +++ b/spec/ruby/library/stringio/pos_spec.rb @@ -1,9 +1,17 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) -require File.expand_path('../shared/tell', __FILE__) +require_relative '../../spec_helper' +require_relative 'fixtures/classes' describe "StringIO#pos" do - it_behaves_like :stringio_tell, :pos + before :each do + @io = StringIOSpecs.build + end + + it "returns the current byte offset" do + @io.getc + @io.pos.should == 1 + @io.read(7) + @io.pos.should == 8 + end end describe "StringIO#pos=" do @@ -17,7 +25,7 @@ describe "StringIO#pos=" do end it "raises an EINVAL if given a negative argument" do - lambda { @io.pos = -10 }.should raise_error(Errno::EINVAL) + -> { @io.pos = -10 }.should.raise(Errno::EINVAL) end it "updates the current byte offset after reaching EOF" do |
