diff options
| author | Thomas Marshall <thomas@thomasmarshall.com> | 2024-05-31 20:45:41 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-06-25 14:32:20 +0000 |
| commit | b88ac94eec96c05ae230e37ca4c59ac236340082 (patch) | |
| tree | 6510c184fa9c5779b93179b072c9520e3a4dd16a | |
| parent | 39951293b492b3b392ccb7a168fe723b03257ac3 (diff) | |
[rubygems/rubygems] Only validate resolution info in Bundler
This commit switches out the full gemspec validation for a partial one
which only performs resolution related checks. This will allow gem
authors to run `bundle` commands immediately after creating a new gem
with Bundler, rather than having to fix metadata validation issues in
the default gemspec.
https://github.com/rubygems/rubygems/commit/d5aa9cae9d
| -rw-r--r-- | lib/bundler/rubygems_integration.rb | 2 | ||||
| -rw-r--r-- | spec/bundler/bundler/rubygems_integration_spec.rb | 6 | ||||
| -rw-r--r-- | spec/bundler/commands/exec_spec.rb | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 5f7a2e9c1f..1302333510 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -52,7 +52,7 @@ module Bundler end def validate(spec) - Bundler.ui.silence { spec.validate(false) } + Bundler.ui.silence { spec.validate_for_resolution } rescue Gem::InvalidSpecificationException => e error_message = "The gemspec at #{spec.loaded_from} is not valid. Please fix this gemspec.\n" \ "The validation error was '#{e.message}'\n" diff --git a/spec/bundler/bundler/rubygems_integration_spec.rb b/spec/bundler/bundler/rubygems_integration_spec.rb index b6bda9f43e..81859d10f2 100644 --- a/spec/bundler/bundler/rubygems_integration_spec.rb +++ b/spec/bundler/bundler/rubygems_integration_spec.rb @@ -11,14 +11,14 @@ RSpec.describe Bundler::RubygemsIntegration do end subject { Bundler.rubygems.validate(spec) } - it "validates with packaging mode disabled" do - expect(spec).to receive(:validate).with(false) + it "validates for resolution" do + expect(spec).to receive(:validate_for_resolution) subject end context "with an invalid spec" do before do - expect(spec).to receive(:validate).with(false). + expect(spec).to receive(:validate_for_resolution). and_raise(Gem::InvalidSpecificationException.new("TODO is not an author")) end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 9f5f12739a..1da8f626fa 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -674,6 +674,7 @@ RSpec.describe "bundle exec" do s.version = '1.0' s.summary = 'TODO: Add summary' s.authors = 'Me' + s.rubygems_version = nil end G end @@ -686,7 +687,7 @@ RSpec.describe "bundle exec" do bundle "exec irb", raise_on_error: false expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid") - expect(err).to match('"TODO" is not a summary') + expect(err).to match(/missing value for attribute rubygems_version|rubygems_version must not be nil/) end end |
