diff options
Diffstat (limited to 'spec/ruby/library/stringio/eof_spec.rb')
| -rw-r--r-- | spec/ruby/library/stringio/eof_spec.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/spec/ruby/library/stringio/eof_spec.rb b/spec/ruby/library/stringio/eof_spec.rb index af0170977c..acc49305f5 100644 --- a/spec/ruby/library/stringio/eof_spec.rb +++ b/spec/ruby/library/stringio/eof_spec.rb @@ -1,11 +1,33 @@ require_relative '../../spec_helper' -require_relative 'fixtures/classes' -require_relative 'shared/eof' +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 |
