diff options
Diffstat (limited to 'spec/ruby/library/stringio/pos_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringio/pos_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/ruby/library/stringio/pos_spec.rb b/spec/ruby/library/stringio/pos_spec.rb index 8d99294f31..16f068b049 100644 --- a/spec/ruby/library/stringio/pos_spec.rb +++ b/spec/ruby/library/stringio/pos_spec.rb @@ -1,9 +1,17 @@ require_relative '../../spec_helper' require_relative 'fixtures/classes' -require_relative 'shared/tell' 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 |
