diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index b5c377f43a..f1f6b853a4 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -110,6 +110,8 @@ class Gem::TestCase < Minitest::Test TEST_PATH = ENV.fetch('RUBYGEMS_TEST_PATH', File.expand_path('../../../test/rubygems', __FILE__)) + SPECIFICATIONS = File.expand_path(File.join(TEST_PATH, "specifications"), __FILE__) + def assert_activate(expected, *specs) specs.each do |spec| case spec diff --git a/test/rubygems/specifications/rubyforge-0.0.1.gemspec b/test/rubygems/specifications/rubyforge-0.0.1.gemspec new file mode 100644 index 0000000000..0df2c4c379 --- /dev/null +++ b/test/rubygems/specifications/rubyforge-0.0.1.gemspec @@ -0,0 +1,14 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = "rubyforge" + s.version = "0.0.1" + s.platform = "ruby" + s.require_paths = ["lib"] + s.summary = "A very bar gem" + s.authors = ["unknown"] + s.license = 'MIT' + s.homepage = 'http://example.com' + s.files = ['README.md'] + s.rubyforge_project = 'abc' +end diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb index 9dfba75cf5..76ede1466f 100644 --- a/test/rubygems/test_gem_commands_build_command.rb +++ b/test/rubygems/test_gem_commands_build_command.rb @@ -127,6 +127,23 @@ class TestGemCommandsBuildCommand < Gem::TestCase util_test_build_gem @gem end + def test_execute_rubyforge_project_warning + rubyforge_gemspec = File.join SPECIFICATIONS, "rubyforge-0.0.1.gemspec" + + @cmd.options[:args] = [rubyforge_gemspec] + + use_ui @ui do + Dir.chdir @tempdir do + @cmd.execute + end + end + + error = @ui.error.split("\n") + assert_equal "WARNING: rubyforge_project= is deprecated and ignored. Please remove this from your gemspec to ensure that your gem continues to build in the future.", error.shift + assert_equal "WARNING: See https://guides.rubygems.org/specification-reference/ for help", error.shift + assert_equal [], error + end + def test_execute_strict_with_warnings bad_gem = util_spec 'some_bad_gem' do |s| s.files = ['README.md'] diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb index 8553194c44..91a46d7842 100644 --- a/test/rubygems/test_gem_stub_specification.rb +++ b/test/rubygems/test_gem_stub_specification.rb @@ -4,7 +4,6 @@ require "rubygems/stub_specification" class TestStubSpecification < Gem::TestCase - SPECIFICATIONS = File.expand_path(File.join("..", "specifications"), __FILE__) FOO = File.join SPECIFICATIONS, "foo-0.0.1-x86-mswin32.gemspec" BAR = File.join SPECIFICATIONS, "bar-0.0.2.gemspec"