diff options
Diffstat (limited to 'test/rubygems/test_gem_commands_build_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_build_command.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb index 1edb30f221..d44126d204 100644 --- a/test/rubygems/test_gem_commands_build_command.rb +++ b/test/rubygems/test_gem_commands_build_command.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require_relative "helper" require "rubygems/commands/build_command" require "rubygems/package" @@ -25,8 +26,9 @@ class TestGemCommandsBuildCommand < Gem::TestCase end @gem = util_spec "some_gem" do |s| - s.license = "AGPL-3.0" + s.license = "AGPL-3.0-only" s.files = ["README.md"] + s.required_ruby_version = "2.3.0" end @cmd = Gem::Commands::BuildCommand.new @@ -41,6 +43,16 @@ class TestGemCommandsBuildCommand < Gem::TestCase assert_includes Gem.platforms, Gem::Platform.local end + def test_handle_deprecated_options + use_ui @ui do + @cmd.handle_options %w[-C ./test/dir] + end + + assert_equal "WARNING: The \"-C\" option has been deprecated and will be removed in Rubygems 4.0. " \ + "-C is a global flag now. Use `gem -C PATH build GEMSPEC_FILE [options]` instead\n", + @ui.error + end + def test_options_filename gemspec_file = File.join(@tempdir, @gem.spec_name) @@ -167,6 +179,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase def test_execute_strict_with_warnings bad_gem = util_spec "some_bad_gem" do |s| s.files = ["README.md"] + s.required_ruby_version = ">= 1.9.3" end gemspec_file = File.join(@tempdir, bad_gem.spec_name) @@ -187,8 +200,9 @@ class TestGemCommandsBuildCommand < Gem::TestCase end error = @ui.error.split "\n" - assert_equal "WARNING: licenses is empty, but is recommended. Use a license identifier from", error.shift - assert_equal "http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.", error.shift + assert_equal "WARNING: licenses is empty, but is recommended. Use an license identifier from", error.shift + assert_equal "https://spdx.org/licenses or 'Nonstandard' for a nonstandard license,", error.shift + assert_equal "or set it to nil if you don't want to specify a license.", error.shift assert_equal "WARNING: See https://guides.rubygems.org/specification-reference/ for help", error.shift assert_equal [], error @@ -582,7 +596,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase end def test_build_signed_gem - pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform? + pend "openssl is missing" unless Gem::HAVE_OPENSSL && !Gem.java_platform? trust_dir = Gem::Security.trust_dir @@ -609,7 +623,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase end def test_build_signed_gem_with_cert_expiration_length_days - pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform? + pend "openssl is missing" unless Gem::HAVE_OPENSSL && !Gem.java_platform? gem_path = File.join Gem.user_home, ".gem" Dir.mkdir gem_path @@ -653,7 +667,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase end def test_build_auto_resign_cert - pend "openssl is missing" unless Gem::HAVE_OPENSSL && !java_platform? + pend "openssl is missing" unless Gem::HAVE_OPENSSL && !Gem.java_platform? gem_path = File.join Gem.user_home, ".gem" Dir.mkdir gem_path @@ -689,7 +703,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase output = @ui.output.split "\n" assert_equal "INFO: Your certificate has expired, trying to re-sign it...", output.shift - assert_equal "INFO: Your cert: #{tmp_expired_cert_file } has been auto re-signed with the key: #{tmp_private_key_file}", output.shift + assert_equal "INFO: Your cert: #{tmp_expired_cert_file} has been auto re-signed with the key: #{tmp_private_key_file}", output.shift assert_match(/INFO: Your expired cert will be located at: .+\Wgem-public_cert\.pem\.expired\.[0-9]+/, output.shift) end |