summaryrefslogtreecommitdiff
path: root/lib/rubygems/test_utilities.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/test_utilities.rb')
-rw-r--r--lib/rubygems/test_utilities.rb31
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index 8b23d3236e..751c13441b 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -11,9 +11,9 @@ require 'rubygems/remote_fetcher'
# @fetcher = Gem::FakeFetcher.new
# @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml
# Gem::RemoteFetcher.fetcher = @fetcher
-#
+#
# # invoke RubyGems code
-#
+#
# paths = @fetcher.paths
# assert_equal 'http://gems.example.com/yaml', paths.shift
# assert paths.empty?, paths.join(', ')
@@ -102,30 +102,17 @@ end
#--
# This class was added to flush out problems in Rubinius' IO implementation.
-class TempIO
-
- @@count = 0
-
+class TempIO < Tempfile
def initialize(string = '')
- @tempfile = Tempfile.new "TempIO-#{@@count += 1}"
- @tempfile.binmode
- @tempfile.write string
- @tempfile.rewind
- end
-
- def method_missing(meth, *args, &block)
- @tempfile.send(meth, *args, &block)
- end
-
- def respond_to?(meth)
- @tempfile.respond_to? meth
+ super "TempIO"
+ binmode
+ write string
+ rewind
end
def string
- @tempfile.flush
-
- Gem.read_binary @tempfile.path
+ flush
+ Gem.read_binary path
end
-
end