diff options
author | John Hong <john.hong@shopify.com> | 2023-08-17 22:06:37 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-18 16:42:49 +0000 |
commit | 744bc4d5d0df32056d5352ed49ae504f6a031e78 (patch) | |
tree | 0c4429d8f85b214b706bbe1c488b7bef41f9438c /test/rubygems | |
parent | 4524aeba2f181df08b68587da140becd2dfa389f (diff) | |
download | ruby-744bc4d5d0df32056d5352ed49ae504f6a031e78.tar.gz |
[rubygems/rubygems] Make nil a valid license spec
https://github.com/rubygems/rubygems/commit/675effb67e
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_gem_commands_build_command.rb | 3 | ||||
-rw-r--r-- | test/rubygems/test_gem_specification.rb | 29 |
2 files changed, 25 insertions, 7 deletions
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb index 42f09003fc..42715df8ea 100644 --- a/test/rubygems/test_gem_commands_build_command.rb +++ b/test/rubygems/test_gem_commands_build_command.rb @@ -199,7 +199,8 @@ class TestGemCommandsBuildCommand < Gem::TestCase 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 "http://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 diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 6a893f09c9..9e68c40b7c 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -3086,10 +3086,22 @@ Please report a bug if this causes problems. assert_match <<-WARNING, @ui.error WARNING: licenses is empty, but is recommended. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. WARNING end + def test_validate_nil_license + util_setup_validate + + use_ui @ui do + @a1.license = nil + @a1.validate + end + + assert_empty @ui.error + end + def test_validate_license_in_a_non_packaging_context util_setup_validate @@ -3126,7 +3138,8 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. assert_match <<-WARNING, @ui.error WARNING: license value 'BSD' is invalid. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. WARNING end @@ -3184,11 +3197,13 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. assert_match <<-WARNING, @ui.error WARNING: license value 'GPL-2.0+ FOO' is invalid. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. WARNING assert_match <<-WARNING, @ui.error WARNING: license value 'GPL-2.0 FOO' is invalid. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. WARNING end @@ -3202,7 +3217,8 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. assert_match <<-WARNING, @ui.error WARNING: license value 'GPL-2.0+ WITH Autocofn-exception-2.0' is invalid. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. WARNING end @@ -3216,7 +3232,8 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. assert_match <<-WARNING, @ui.error WARNING: license value 'ruby' is invalid. Use a license identifier from -http://spdx.org/licenses or 'Nonstandard' for a nonstandard license. +http://spdx.org/licenses or 'Nonstandard' for a nonstandard license, +or set it to nil if you don't want to specify a license. Did you mean 'Ruby'? WARNING end |