[rubygems/rubygems] fix @license typo preventing licenses from being correctly unmarshalled

https://github.com/rubygems/rubygems/commit/d6ba7ef79f
This commit is contained in:
Durable Programming Team 2024-08-28 16:53:26 -04:00 committed by git
parent e69945fc57
commit d6fc8f3d57
2 changed files with 13 additions and 1 deletions

View File

@ -1318,7 +1318,7 @@ class Gem::Specification < Gem::BasicSpecification
spec.instance_variable_set :@has_rdoc, array[15]
spec.instance_variable_set :@new_platform, array[16]
spec.instance_variable_set :@platform, array[16].to_s
spec.instance_variable_set :@license, array[17]
spec.instance_variable_set :@licenses, [array[17]]
spec.instance_variable_set :@metadata, array[18]
spec.instance_variable_set :@loaded, false
spec.instance_variable_set :@activated, false

View File

@ -305,6 +305,18 @@ class TestGemSafeMarshal < Gem::TestCase
end
end
def test_gem_spec_unmarshall_license
spec = Gem::Specification.new do |s|
s.name = "hi"
s.version = "1.2.3"
s.license = "MIT"
end
unmarshalled_spec = Gem::SafeMarshal.safe_load(Marshal.dump(spec))
assert_equal ["MIT"], unmarshalled_spec.license
end
def test_gem_spec_disallowed_symbol
e = assert_raise(Gem::SafeMarshal::Visitors::ToRuby::UnpermittedSymbolError) do
spec = Gem::Specification.new do |s|