summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/specification_policy.rb2
-rw-r--r--test/rubygems/test_gem_specification.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb
index f96e95b5e1..3a3dba9950 100644
--- a/lib/rubygems/specification_policy.rb
+++ b/lib/rubygems/specification_policy.rb
@@ -44,7 +44,7 @@ class Gem::SpecificationPolicy
def validate(strict = false)
validate_required!
- validate_optional(strict)
+ validate_optional(strict) if packaging || strict
true
end
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index e223171aef..d0f11bfa02 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -3141,6 +3141,17 @@ http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
WARNING
end
+ def test_validate_license_in_a_non_packaging_context
+ util_setup_validate
+
+ use_ui @ui do
+ @a1.licenses.clear
+ @a1.validate(false)
+ end
+
+ assert_empty @ui.error
+ end
+
def test_removed_methods
assert_equal Gem::Specification::REMOVED_METHODS, [:rubyforge_project=]
end