aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_ext_rake_builder.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-24 02:38:57 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-24 02:38:57 +0000
commit5d438215365e1a5dc3da7172a511a335aa58a5b4 (patch)
tree72ac80942856be3a5370dea6458f3b6dfce671e4 /test/rubygems/test_gem_ext_rake_builder.rb
parent6219b68fb53a77a221f615d47dde83fea0a7e7c8 (diff)
downloadruby-5d438215365e1a5dc3da7172a511a335aa58a5b4.tar.gz
Update Rubygems 2.6.10
* https://github.com/rubygems/rubygems/commit/2ee5bf9fd3bd7649d3e244bc40107ff32070ef47 * https://github.com/rubygems/rubygems/commit/be510dd4097e65c6a256a6e173d6b724a3a96472 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_ext_rake_builder.rb')
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb51
1 files changed, 34 insertions, 17 deletions
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index b728f8f30a..9f59f51660 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -14,14 +14,7 @@ class TestGemExtRakeBuilder < Gem::TestCase
end
def test_class_build
- File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
- mkrf_conf.puts <<-EO_MKRF
- File.open("Rakefile","w") do |f|
- f.puts "task :default"
- end
- EO_MKRF
- end
-
+ create_temp_mkrf_file('task :default')
output = []
realdir = nil # HACK /tmp vs. /private/tmp
@@ -39,15 +32,31 @@ class TestGemExtRakeBuilder < Gem::TestCase
end
end
- def test_class_build_fail
- File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
- mkrf_conf.puts <<-EO_MKRF
- File.open("Rakefile","w") do |f|
- f.puts "task :default do abort 'fail' end"
- end
- EO_MKRF
+ # https://github.com/rubygems/rubygems/pull/1819
+ #
+ # It should not fail with a non-empty args list either
+ def test_class_build_with_args
+ create_temp_mkrf_file('task :default')
+ output = []
+ realdir = nil # HACK /tmp vs. /private/tmp
+
+ build_rake_in do |rake|
+ Dir.chdir @ext do
+ realdir = Dir.pwd
+ non_empty_args_list = ['']
+ Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output, non_empty_args_list
+ end
+
+ output = output.join "\n"
+
+ refute_match %r%^rake failed:%, output
+ assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
+ assert_match %r%^#{Regexp.escape rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
end
+ end
+ def test_class_build_fail
+ create_temp_mkrf_file("task :default do abort 'fail' end")
output = []
build_rake_in(false) do |rake|
@@ -60,6 +69,14 @@ class TestGemExtRakeBuilder < Gem::TestCase
assert_match %r%^rake failed%, error.message
end
end
-
+
+ def create_temp_mkrf_file(rakefile_content)
+ File.open File.join(@ext, 'mkrf_conf.rb'), 'w' do |mkrf_conf|
+ mkrf_conf.puts <<-EO_MKRF
+ File.open("Rakefile","w") do |f|
+ f.puts "#{rakefile_content}"
+ end
+ EO_MKRF
+ end
+ end
end
-