aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/zlib/gzipfile/orig_name_spec.rb')
-rw-r--r--spec/ruby/library/zlib/gzipfile/orig_name_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
new file mode 100644
index 0000000000..42a3b2f376
--- /dev/null
+++ b/spec/ruby/library/zlib/gzipfile/orig_name_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+require 'stringio'
+require 'zlib'
+
+describe "Zlib::GzipFile#orig_name" do
+ before :each do
+ @io = StringIO.new
+ end
+
+ it "returns the name" do
+ Zlib::GzipWriter.wrap @io do |gzio|
+ gzio.orig_name = 'name'
+
+ gzio.orig_name.should == 'name'
+ end
+ end
+
+ it "raises an error on a closed stream" do
+ Zlib::GzipWriter.wrap @io do |gzio|
+ gzio.close
+
+ lambda { gzio.orig_name }.should \
+ raise_error(Zlib::GzipFile::Error, 'closed gzip stream')
+ end
+ end
+end
+