diff options
Diffstat (limited to 'spec/ruby/library/tempfile/size_spec.rb')
| -rw-r--r-- | spec/ruby/library/tempfile/size_spec.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/ruby/library/tempfile/size_spec.rb b/spec/ruby/library/tempfile/size_spec.rb index f4824601c7..5a7edf8e4b 100644 --- a/spec/ruby/library/tempfile/size_spec.rb +++ b/spec/ruby/library/tempfile/size_spec.rb @@ -1,7 +1,24 @@ require_relative '../../spec_helper' -require_relative 'shared/length' require 'tempfile' describe "Tempfile#size" do - it_behaves_like :tempfile_length, :size + before :each do + @tempfile = Tempfile.new("specs") + end + + after :each do + @tempfile.close! + end + + it "returns the size of self" do + @tempfile.size.should.eql?(0) + @tempfile.print("Test!") + @tempfile.size.should.eql?(5) + end + + it "returns the size of self even if self is closed" do + @tempfile.print("Test!") + @tempfile.close + @tempfile.size.should.eql?(5) + end end |
