diff options
Diffstat (limited to 'spec/ruby/library/tempfile/size_spec.rb')
| -rw-r--r-- | spec/ruby/library/tempfile/size_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/library/tempfile/size_spec.rb b/spec/ruby/library/tempfile/size_spec.rb new file mode 100644 index 0000000000..5a7edf8e4b --- /dev/null +++ b/spec/ruby/library/tempfile/size_spec.rb @@ -0,0 +1,24 @@ +require_relative '../../spec_helper' +require 'tempfile' + +describe "Tempfile#size" do + 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 |
