aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/test_case.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-01 12:43:26 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-01 12:43:26 +0000
commita21d403f21473b21b5766c2483b4325240e9edda (patch)
treebd10197f9589251f35f0f9dc6fa387f0e298a6ef /lib/rubygems/test_case.rb
parent94cfa2893ccab71341d4671201253339d56d6c97 (diff)
downloadruby-a21d403f21473b21b5766c2483b4325240e9edda.tar.gz
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.
It supports to enable frozen string literal and add `--norc` option for disable to `.gemrc` configuration. See 2.5.2 release notes for other fixes and enhancements. https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r--lib/rubygems/test_case.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 3ffc608a1c..aebc36bc6c 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
# TODO: $SAFE = 1
begin
@@ -542,7 +542,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
# Enables pretty-print for all tests
def mu_pp(obj)
- s = ''
+ s = String.new
s = PP.pp obj, s
s = s.force_encoding(Encoding.default_external) if defined? Encoding
s.chomp
@@ -1307,12 +1307,22 @@ Also, a list:
def vendor_gem name = 'a', version = 1
directory = File.join 'vendor', name
+ FileUtils.mkdir_p directory
+
+ save_gemspec name, version, directory
+ end
+
+ ##
+ # create_gemspec creates gem specification in given +direcotry+ or '.'
+ # for the given +name+ and +version+.
+ #
+ # Yields the +specification+ to the block, if given
+
+ def save_gemspec name = 'a', version = 1, directory = '.'
vendor_spec = Gem::Specification.new name, version do |specification|
yield specification if block_given?
end
- FileUtils.mkdir_p directory
-
open File.join(directory, "#{name}.gemspec"), 'w' do |io|
io.write vendor_spec.to_ruby
end
@@ -1483,3 +1493,4 @@ tmpdirs << (ENV['GEM_PATH'] = Dir.mktmpdir("path"))
pid = $$
END {tmpdirs.each {|dir| Dir.rmdir(dir)} if $$ == pid}
Gem.clear_paths
+