diff options
Diffstat (limited to 'spec/ruby/library/stringio/eof_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringio/eof_spec.rb | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/spec/ruby/library/stringio/eof_spec.rb b/spec/ruby/library/stringio/eof_spec.rb index a5bb3dbe3d..acc49305f5 100644 --- a/spec/ruby/library/stringio/eof_spec.rb +++ b/spec/ruby/library/stringio/eof_spec.rb @@ -1,11 +1,33 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require File.expand_path('../fixtures/classes', __FILE__) -require File.expand_path('../shared/eof', __FILE__) +require_relative '../../spec_helper' +require 'stringio' describe "StringIO#eof?" do - it_behaves_like :stringio_eof, :eof? + before :each do + @io = StringIO.new("eof") + end + + it "returns true when self's position is greater than or equal to self's size" do + @io.pos = 3 + @io.eof?.should == true + + @io.pos = 6 + @io.eof?.should == true + end + + it "returns false when self's position is less than self's size" do + @io.pos = 0 + @io.eof?.should == false + + @io.pos = 1 + @io.eof?.should == false + + @io.pos = 2 + @io.eof?.should == false + end end describe "StringIO#eof" do - it_behaves_like :stringio_eof, :eof + it "is an alias of StringIO#eof?" do + StringIO.instance_method(:eof).should == StringIO.instance_method(:eof?) + end end |
