summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/package.rb5
-rw-r--r--test/rubygems/test_gem_package.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 49cdf98b310..16cda5affec 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -100,6 +100,11 @@ class Gem::Package
attr_reader :files
##
+ # Reference to the gem being packaged.
+
+ attr_reader :gem
+
+ ##
# The security policy used for verifying the contents of this package.
attr_accessor :security_policy
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index e07304e9a5e..f2f712ebe0b 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -1093,6 +1093,11 @@ class TestGemPackage < Gem::Package::TarTestCase
assert_equal @spec, package.spec
end
+ def test_gem_attr
+ package = Gem::Package.new(@gem)
+ assert_equal(package.gem, @gem)
+ end
+
def test_spec_from_io
# This functionality is used by rubygems.org to extract spec data from an
# uploaded gem before it is written to storage.