diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-03-24 04:52:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 04:52:19 +0900 |
commit | 2efda212b0d9ad5ec265271db25ad51d796fde44 (patch) | |
tree | b2667694205da0fd71dfa8dafc2655f6d464896e /spec/bundler | |
parent | ff2ea4daeb795ebb3d0afa8c57d86a4af9757e50 (diff) |
Merge RubyGems-3.2.15 and Bundler-2.2.15 (#4311)
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/bundler/installer/parallel_installer_spec.rb | 33 | ||||
-rw-r--r-- | spec/bundler/bundler/installer/spec_installation_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/path_spec.rb | 3 | ||||
-rw-r--r-- | spec/bundler/lock/lockfile_spec.rb | 24 | ||||
-rw-r--r-- | spec/bundler/runtime/platform_spec.rb | 38 |
5 files changed, 101 insertions, 1 deletions
diff --git a/spec/bundler/bundler/installer/parallel_installer_spec.rb b/spec/bundler/bundler/installer/parallel_installer_spec.rb index ace5c1a23a..e680633862 100644 --- a/spec/bundler/bundler/installer/parallel_installer_spec.rb +++ b/spec/bundler/bundler/installer/parallel_installer_spec.rb @@ -44,4 +44,37 @@ The missing gems are: end end end + + context "when the spec set is not a valid resolution" do + let(:all_specs) do + [ + build_spec("cucumber", "4.1.0") {|s| s.runtime "diff-lcs", "< 1.4" }, + build_spec("diff-lcs", "1.4.4"), + ].flatten + end + + it "prints a warning" do + expect(Bundler.ui).to receive(:warn).with(<<-W.strip) +Your lockfile doesn't include a valid resolution. +You can fix this by regenerating your lockfile or trying to manually editing the bad locked gems to a version that satisfies all dependencies. +The unmet dependencies are: +* diff-lcs (< 1.4), depended upon cucumber-4.1.0, unsatisfied by diff-lcs-1.4.4 + W + subject.check_for_unmet_dependencies + end + end + + context "when the spec set is a valid resolution" do + let(:all_specs) do + [ + build_spec("cucumber", "4.1.0") {|s| s.runtime "diff-lcs", "< 1.4" }, + build_spec("diff-lcs", "1.3"), + ].flatten + end + + it "doesn't print a warning" do + expect(Bundler.ui).not_to receive(:warn) + subject.check_for_unmet_dependencies + end + end end diff --git a/spec/bundler/bundler/installer/spec_installation_spec.rb b/spec/bundler/bundler/installer/spec_installation_spec.rb index a9cf09a372..e63ef26cb3 100644 --- a/spec/bundler/bundler/installer/spec_installation_spec.rb +++ b/spec/bundler/bundler/installer/spec_installation_spec.rb @@ -8,6 +8,10 @@ RSpec.describe Bundler::ParallelInstaller::SpecInstallation do def a_spec.name "I like tests" end + + def a_spec.full_name + "I really like tests" + end a_spec end diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index 7322d11892..e78217d369 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -328,11 +328,12 @@ RSpec.describe "bundle install with explicit source paths" do s.executables = "foobar" end - install_gemfile <<-G + install_gemfile <<-G, :verbose => true path "#{lib_path("foo-1.0")}" do gem 'foo' end G + expect(out).to include("Using foo 1.0 from source at `#{lib_path("foo-1.0")}` and installing its executables") expect(the_bundle).to include_gems "foo 1.0" bundle "exec foobar" diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index 639ccb87ea..7ef85ecf13 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -641,6 +641,30 @@ RSpec.describe "the lockfile format" do G end + it "removes redundant sources" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}/" + + gem "rack", :source => "#{file_uri_for(gem_repo2)}/" + G + + lockfile_should_be <<-G + GEM + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + it "lists gems alphabetically" do install_gemfile <<-G source "#{file_uri_for(gem_repo2)}/" diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb index 154d967e12..bec42e0f70 100644 --- a/spec/bundler/runtime/platform_spec.rb +++ b/spec/bundler/runtime/platform_spec.rb @@ -108,6 +108,44 @@ RSpec.describe "Bundler.setup with multi platform stuff" do expect(lockfile).to eq(good_lockfile) end + it "will not try to install platform specific gems when they don't match the current ruby if locked only to ruby" do + build_repo4 do + build_gem "nokogiri", "1.11.1" + + build_gem "nokogiri", "1.11.1" do |s| + s.platform = Bundler.local_platform + s.required_ruby_version = "< #{Gem.ruby_version}" + end + end + + gemfile <<-G + source "https://gems.repo4" + gem "nokogiri" + G + + lockfile <<~L + GEM + remote: https://gems.repo4/ + specs: + nokogiri (1.11.1) + + PLATFORMS + ruby + + DEPENDENCIES + nokogiri + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "install", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } + + expect(out).to include("Fetching nokogiri 1.11.1") + expect(the_bundle).to include_gems "nokogiri 1.11.1" + expect(the_bundle).not_to include_gems "nokogiri 1.11.1 #{Bundler.local_platform}" + end + it "will use the java platform if both generic java and generic ruby platforms are locked", :jruby do gemfile <<-G source "#{file_uri_for(gem_repo1)}" |