Skip to content

Commit

Permalink
Only run optional validations in packaging contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed May 31, 2020
1 parent 63076c4 commit 4d848a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rubygems/specification_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def initialize(specification)
def validate(strict = false)
validate_required!

validate_optional(strict)
validate_optional(strict) if packaging || strict

true
end
Expand Down
11 changes: 11 additions & 0 deletions test/rubygems/test_gem_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,17 @@ def test_validate_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
Expand Down

0 comments on commit 4d848a6

Please sign in to comment.