diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-03-02 20:37:31 +0900 |
---|---|---|
committer | NARUSE, Yui <nurse@users.noreply.github.com> | 2021-03-11 17:24:52 +0900 |
commit | f375bc77d2f347dd2a44705b8abd29398feae427 (patch) | |
tree | 0988ab2b519e713ae653cc2e23609b339a9b5979 /spec | |
parent | 38f8b8d070aaac02f1d048b5d9947b2e58401e2b (diff) |
Merge RubyGems-3.2.11 and Bundler-2.2.11
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/bundler/dsl_spec.rb | 15 | ||||
-rw-r--r-- | spec/bundler/bundler/plugin_spec.rb | 1 | ||||
-rw-r--r-- | spec/bundler/bundler/source_list_spec.rb | 21 | ||||
-rw-r--r-- | spec/bundler/commands/exec_spec.rb | 3 | ||||
-rw-r--r-- | spec/bundler/commands/post_bundle_message_spec.rb | 11 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/gemspec_spec.rb | 15 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/sources_spec.rb | 271 | ||||
-rw-r--r-- | spec/bundler/install/gems/flex_spec.rb | 32 | ||||
-rw-r--r-- | spec/bundler/lock/lockfile_spec.rb | 35 | ||||
-rw-r--r-- | spec/bundler/other/major_deprecation_spec.rb | 104 | ||||
-rw-r--r-- | spec/bundler/support/indexes.rb | 2 |
11 files changed, 245 insertions, 265 deletions
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb index a47dd6e399..ff87b57886 100644 --- a/spec/bundler/bundler/dsl_spec.rb +++ b/spec/bundler/bundler/dsl_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Bundler::Dsl do expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption) end - context "default hosts", :bundler => "< 3" do + context "default hosts", :bundler => "2" do it "converts :github to URI using https" do subject.gem("sparks", :github => "indirect/sparks") github_uri = "https://github.com/indirect/sparks.git" @@ -195,6 +195,19 @@ RSpec.describe Bundler::Dsl do # gem 'spree_api' # gem 'spree_backend' # end + describe "#github", :bundler => "< 3" do + it "from github" do + spree_gems = %w[spree_core spree_api spree_backend] + subject.github "spree" do + spree_gems.each {|spree_gem| subject.send :gem, spree_gem } + end + + subject.dependencies.each do |d| + expect(d.source.uri).to eq("https://github.com/spree/spree.git") + end + end + end + describe "#github" do it "from github" do spree_gems = %w[spree_core spree_api spree_backend] diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb index d18896895e..8c95723bcc 100644 --- a/spec/bundler/bundler/plugin_spec.rb +++ b/spec/bundler/bundler/plugin_spec.rb @@ -112,7 +112,6 @@ RSpec.describe Bundler::Plugin do before do allow(Plugin::DSL).to receive(:new) { builder } allow(builder).to receive(:eval_gemfile).with(gemfile) - allow(builder).to receive(:check_primary_source_safety) allow(builder).to receive(:to_definition) { definition } allow(builder).to receive(:inferred_plugins) { [] } end diff --git a/spec/bundler/bundler/source_list_spec.rb b/spec/bundler/bundler/source_list_spec.rb index 0c40ba8a77..3a0691b959 100644 --- a/spec/bundler/bundler/source_list_spec.rb +++ b/spec/bundler/bundler/source_list_spec.rb @@ -372,7 +372,26 @@ RSpec.describe Bundler::SourceList do source_list.add_git_source("uri" => "git://first-git.org/path.git") end - it "returns all sources, without combining rubygems sources" do + it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 3" do + expect(source_list.lock_sources).to eq [ + Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), + Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), + Bundler::Source::Git.new("uri" => "git://third-git.org/path.git"), + ASourcePlugin.new("uri" => "https://second-plugin.org/random"), + ASourcePlugin.new("uri" => "https://third-bar.org/foo"), + Bundler::Source::Path.new("path" => "/first/path/to/gem"), + Bundler::Source::Path.new("path" => "/second/path/to/gem"), + Bundler::Source::Path.new("path" => "/third/path/to/gem"), + Bundler::Source::Rubygems.new("remotes" => [ + "https://duplicate-rubygems.org", + "https://first-rubygems.org", + "https://second-rubygems.org", + "https://third-rubygems.org", + ]), + ] + end + + it "returns all sources, without combining rubygems sources", :bundler => "3" do expect(source_list.lock_sources).to eq [ Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index bb4091ef98..5d43586116 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -762,8 +762,7 @@ RSpec.describe "bundle exec" do let(:exit_code) { Bundler::GemNotFound.new.status_code } let(:expected) { "" } let(:expected_err) { <<-EOS.strip } -\e[31mCould not find gem 'rack (= 2)' in locally installed gems. -The source contains the following versions of 'rack': 0.9.1, 1.0.0\e[0m +\e[31mCould not find gem 'rack (= 2)' in any of the gem sources listed in your Gemfile.\e[0m \e[33mRun `bundle install` to install missing gems.\e[0m EOS diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 3f81808980..2c965f0ddd 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -113,7 +113,16 @@ RSpec.describe "post bundle message" do bundle "config set force_ruby_platform true" end - it "should report a helpful error message" do + it "should report a helpful error message", :bundler => "< 3" do + install_gemfile <<-G, :raise_on_error => false + source "#{file_uri_for(gem_repo1)}" + gem "rack" + gem "not-a-gem", :group => :development + G + expect(err).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.") + end + + it "should report a helpful error message", :bundler => "3" do install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem "rack" diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb index 4001df26da..7a95a8abde 100644 --- a/spec/bundler/install/gemfile/gemspec_spec.rb +++ b/spec/bundler/install/gemfile/gemspec_spec.rb @@ -422,13 +422,14 @@ RSpec.describe "bundle install from an existing gemspec" do end end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" - gemspec - G - - simulate_platform("ruby") { bundle "install" } - simulate_platform("jruby") { bundle "install" } + %w[ruby jruby].each do |platform| + simulate_platform(platform) do + install_gemfile <<-G + source "#{file_uri_for(gem_repo2)}" + gemspec + G + end + end end context "on ruby" do diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb index e40ae84c59..655f91dd69 100644 --- a/spec/bundler/install/gemfile/sources_spec.rb +++ b/spec/bundler/install/gemfile/sources_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 3" do + it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "2" do bundle :install expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") @@ -54,7 +54,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do + it "warns about ambiguous gems, but installs anyway", :bundler => "2" do bundle :install expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: #{file_uri_for(gem_repo1)}") @@ -96,7 +96,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs the gems without any warning" do bundle :install - expect(err).not_to include("Warning") + expect(out).not_to include("Warning") expect(the_bundle).to include_gems("rack-obama 1.0.0") expect(the_bundle).to include_gems("rack 1.0.0", :source => "remote1") end @@ -128,7 +128,7 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - install_gemfile <<-G + gemfile <<-G source "#{file_uri_for(gem_repo3)}" gem "rack-obama" # should come from repo3! gem "rack", :source => "#{file_uri_for(gem_repo1)}" @@ -136,7 +136,8 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs the gems without any warning" do - expect(err).not_to include("Warning") + bundle :install + expect(out).not_to include("Warning") expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0") end end @@ -172,8 +173,8 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs from the same source without any warning" do bundle :install - expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + expect(out).not_to include("Warning") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -187,38 +188,27 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - it "installs from the same source without any warning" do - bundle :install + context "when disable_multisource is set" do + before do + bundle "config set disable_multisource true" + end - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") + it "installs from the same source without any warning" do + bundle :install - # In https://github.com/bundler/bundler/issues/3585 this failed - # when there is already a lock file, and the gems are missing, so try again - system_gems [] - bundle :install + expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") - end - end + # when there is already a lock file, and the gems are missing, so try again + system_gems [] + bundle :install - context "and in another source with a higher version" do - before do - # need this to be broken to check for correct source ordering - build_repo gem_repo2 do - build_gem "rack", "1.0.1" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" - end + expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end end - - it "installs from the same source without any warning" do - bundle :install - - expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", :source => "remote3") - end end end @@ -232,7 +222,7 @@ RSpec.describe "bundle install with gems on multiple sources" do context "and not in any other sources" do before do - install_gemfile <<-G + gemfile <<-G source "#{file_uri_for(gem_repo2)}" source "#{file_uri_for(gem_repo3)}" do gem "depends_on_rack" @@ -241,7 +231,8 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the other source without any warning" do - expect(err).not_to include("Warning") + bundle :install + expect(out).not_to include("Warning") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -257,7 +248,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do + it "installs from the other source and warns about ambiguous gems", :bundler => "2" do bundle :install expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") expect(err).to include("Installed from: #{file_uri_for(gem_repo2)}") @@ -289,7 +280,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the dependency from the pinned source without warning", :bundler => "< 3" do + it "installs the dependency from the pinned source without warning", :bundler => "2" do bundle :install expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") @@ -314,74 +305,80 @@ RSpec.describe "bundle install with gems on multiple sources" do end context "when a top-level gem has an indirect dependency" do - before do - build_repo gem_repo2 do - build_gem "depends_on_rack", "1.0.1" do |s| - s.add_dependency "rack" - end + context "when disable_multisource is set" do + before do + bundle "config set disable_multisource true" end - build_repo gem_repo3 do - build_gem "unrelated_gem", "1.0.0" - end + before do + build_repo gem_repo2 do + build_gem "depends_on_rack", "1.0.1" do |s| + s.add_dependency "rack" + end + end - gemfile <<-G - source "#{file_uri_for(gem_repo2)}" + build_repo gem_repo3 do + build_gem "unrelated_gem", "1.0.0" + end - gem "depends_on_rack" + gemfile <<-G + source "#{file_uri_for(gem_repo2)}" - source "#{file_uri_for(gem_repo3)}" do - gem "unrelated_gem" - end - G - end + gem "depends_on_rack" - context "and the dependency is only in the top-level source" do - before do - update_repo gem_repo2 do - build_gem "rack", "1.0.0" - end + source "#{file_uri_for(gem_repo3)}" do + gem "unrelated_gem" + end + G end - it "installs all gems without warning" do - bundle :install - expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") + context "and the dependency is only in the top-level source" do + before do + update_repo gem_repo2 do + build_gem "rack", "1.0.0" + end + end + + it "installs all gems without warning" do + bundle :install + expect(err).not_to include("Warning") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") + end end - end - context "and the dependency is only in a pinned source" do - before do - update_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + context "and the dependency is only in a pinned source" do + before do + update_repo gem_repo3 do + build_gem "rack", "1.0.0" do |s| + s.write "lib/rack.rb", "RACK = 'FAIL'" + end end end - end - it "does not find the dependency" do - bundle :install, :raise_on_error => false - expect(err).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources") + it "does not find the dependency" do + bundle :install, :raise_on_error => false + expect(err).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources") + end end - end - context "and the dependency is in both the top-level and a pinned source" do - before do - update_repo gem_repo2 do - build_gem "rack", "1.0.0" - end + context "and the dependency is in both the top-level and a pinned source" do + before do + update_repo gem_repo2 do + build_gem "rack", "1.0.0" + end - update_repo gem_repo3 do - build_gem "rack", "1.0.0" do |s| - s.write "lib/rack.rb", "RACK = 'FAIL'" + update_repo gem_repo3 do + build_gem "rack", "1.0.0" do |s| + s.write "lib/rack.rb", "RACK = 'FAIL'" + end end end - end - it "installs the dependency from the top-level source without warning" do - bundle :install - expect(err).not_to include("Warning") - expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") + it "installs the dependency from the top-level source without warning" do + bundle :install + expect(err).not_to include("Warning") + expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") + end end end end @@ -392,14 +389,15 @@ RSpec.describe "bundle install with gems on multiple sources" do build_gem "not_in_repo1", "1.0.0" end - install_gemfile <<-G, :raise_on_error => false + gemfile <<-G source "#{file_uri_for(gem_repo3)}" gem "not_in_repo1", :source => "#{file_uri_for(gem_repo1)}" G end it "does not install the gem" do - expect(err).to include("Could not find gem 'not_in_repo1") + bundle :install, :raise_on_error => false + expect(err).to include("Could not find gem 'not_in_repo1'") end end @@ -435,92 +433,6 @@ RSpec.describe "bundle install with gems on multiple sources" do end end - context "with a lockfile with aggregated rubygems sources" do - let(:aggregate_gem_section_lockfile) do - <<~L - GEM - remote: #{file_uri_for(gem_repo1)}/ - remote: #{file_uri_for(gem_repo3)}/ - specs: - rack (0.9.1) - - PLATFORMS - #{specific_local_platform} - - DEPENDENCIES - rack! - - BUNDLED WITH - #{Bundler::VERSION} - L - end - - let(:split_gem_section_lockfile) do - <<~L - GEM - remote: #{file_uri_for(gem_repo1)}/ - specs: - - GEM - remote: #{file_uri_for(gem_repo3)}/ - specs: - rack (0.9.1) - - PLATFORMS - #{specific_local_platform} - - DEPENDENCIES - rack! - - BUNDLED WITH - #{Bundler::VERSION} - L - end - - before do - build_repo gem_repo3 do - build_gem "rack", "0.9.1" - end - - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo3)}" do - gem 'rack' - end - G - - lockfile aggregate_gem_section_lockfile - end - - it "installs a lockfile with separate rubygems source sections if not in frozen mode" do - bundle "install" - - expect(lockfile).to eq(split_gem_section_lockfile) - - expect(the_bundle).to include_gems("rack 0.9.1", :source => "remote3") - end - - it "installs the existing lockfile but prints a warning if in frozen mode", :bundler => "< 3" do - bundle "config set --local deployment true" - - bundle "install" - - expect(lockfile).to eq(aggregate_gem_section_lockfile) - - expect(the_bundle).to include_gems("rack 0.9.1", :source => "remote3") - end - - it "refuses to install the existing lockfile and prints an error if in frozen mode", :bundler => "3" do - bundle "config set --local deployment true" - - bundle "install", :raise_on_error =>false - - expect(lockfile).to eq(aggregate_gem_section_lockfile) - expect(err).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure.") - expect(out).to be_empty - end - end - context "with a path gem in the same Gemfile" do before do build_lib "foo" @@ -545,13 +457,14 @@ RSpec.describe "bundle install with gems on multiple sources" do before do system_gems "rack-0.9.1" - install_gemfile <<-G + gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" # shoud come from repo1! G end it "installs the gems without any warning" do + bundle :install expect(err).not_to include("Warning") expect(the_bundle).to include_gems("rack 1.0.0") end @@ -702,12 +615,16 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the higher version in the new repo" do + it "keeps the old version", :bundler => "2" do + expect(the_bundle).to include_gems("rack 1.0.0") + end + + it "installs the higher version in the new repo", :bundler => "3" do expect(the_bundle).to include_gems("rack 1.2") end end - context "when a gem is available from multiple ambiguous sources" do + context "when a gem is available from multiple ambiguous sources", :bundler => "3" do it "raises, suggesting a source block" do build_repo4 do build_gem "depends_on_rack" do |s| diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb index 326ec51214..7ab0ded26d 100644 --- a/spec/bundler/install/gems/flex_spec.rb +++ b/spec/bundler/install/gems/flex_spec.rb @@ -245,7 +245,37 @@ RSpec.describe "bundle flex_install" do end describe "when adding a new source" do - it "updates the lockfile" do + it "updates the lockfile", :bundler => "< 3" do + build_repo2 + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack" + G + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + source "#{file_uri_for(gem_repo2)}" + gem "rack" + G + + lockfile_should_be <<-L + GEM + remote: #{file_uri_for(gem_repo1)}/ + remote: #{file_uri_for(gem_repo2)}/ + specs: + rack (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack + + BUNDLED WITH + #{Bundler::VERSION} + L + end + + it "updates the lockfile", :bundler => "3" do build_repo2 install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb index 639ccb87ea..d3591cd62a 100644 --- a/spec/bundler/lock/lockfile_spec.rb +++ b/spec/bundler/lock/lockfile_spec.rb @@ -318,7 +318,40 @@ RSpec.describe "the lockfile format" do G end - it "generates a lockfile without credentials for a configured source" do + it "generates a lockfile without credentials for a configured source", :bundler => "< 3" do + bundle "config set http://localgemserver.test/ user:pass" + + install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true) + source "http://localgemserver.test/" do + + end + + source "http://user:pass@othergemserver.test/" do + gem "rack-obama", ">= 1.0" + end + G + + lockfile_should_be <<-G + GEM + remote: http://localgemserver.test/ + remote: http://user:pass@othergemserver.test/ + specs: + rack (1.0.0) + rack-obama (1.0) + rack + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rack-obama (>= 1.0)! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + + it "generates a lockfile without credentials for a configured source", :bundler => "3" do bundle "config set http://localgemserver.test/ user:pass" install_gemfile(<<-G, :artifice => "endpoint_strict_basic_authentication", :quiet => true) diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index cb85b6c9cb..d061ca7064 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -17,7 +17,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_env", :bundler => "2" do expect(deprecations).to include \ "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \ @@ -33,7 +33,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_env", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_env", :bundler => "2" do expect(deprecations).to include( "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \ @@ -50,7 +50,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_system", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_system", :bundler => "2" do expect(deprecations).to include( "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \ "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \ @@ -67,7 +67,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .unbundled_exec", :bundler => "< 3" do + it "is deprecated in favor of .unbundled_exec", :bundler => "2" do expect(deprecations).to include( "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \ "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \ @@ -84,7 +84,7 @@ RSpec.describe "major deprecations" do bundle "exec ruby -e #{source.dump}" end - it "is deprecated in favor of .load", :bundler => "< 3" do + it "is deprecated in favor of .load", :bundler => "2" do expect(deprecations).to include "Bundler.environment has been removed in favor of Bundler.load (called at -e:1)" end @@ -109,7 +109,7 @@ RSpec.describe "major deprecations" do bundle "check --path vendor/bundle", :raise_on_error => false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", :bundler => "2" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -118,7 +118,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end context "bundle check --path=" do @@ -131,7 +131,7 @@ RSpec.describe "major deprecations" do bundle "check --path=vendor/bundle", :raise_on_error => false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", :bundler => "2" do expect(deprecations).to include( "The `--path` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -140,7 +140,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end context "bundle cache --all" do @@ -153,7 +153,7 @@ RSpec.describe "major deprecations" do bundle "cache --all", :raise_on_error => false end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", :bundler => "2" do expect(deprecations).to include( "The `--all` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no " \ @@ -162,7 +162,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end describe "bundle config" do @@ -292,7 +292,7 @@ RSpec.describe "major deprecations" do G end - it "should output a deprecation warning", :bundler => "< 3" do + it "should output a deprecation warning", :bundler => "2" do expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") end @@ -356,7 +356,7 @@ RSpec.describe "major deprecations" do bundle "install #{flag_name} #{value}" end - it "should print a deprecation warning", :bundler => "< 3" do + it "should print a deprecation warning", :bundler => "2" do expect(deprecations).to include( "The `#{flag_name}` flag is deprecated because it relies on " \ "being remembered across bundler invocations, which bundler " \ @@ -365,7 +365,7 @@ RSpec.describe "major deprecations" do ) end - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end end end @@ -378,58 +378,18 @@ RSpec.describe "major deprecations" do G end - it "shows a deprecation", :bundler => "< 3" do + it "shows a deprecation", :bundler => "2" do expect(deprecations).to include( "Your Gemfile contains multiple primary sources. " \ "Using `source` more than once without a block is a security risk, and " \ "may result in installing unexpected gems. To resolve this warning, use " \ - "a block to indicate which gems should come from the secondary source." + "a block to indicate which gems should come from the secondary source. " \ + "To upgrade this warning to an error, run `bundle config set --local " \ + "disable_multisource true`." ) end - pending "fails with a helpful error", :bundler => "3" - end - - context "bundle install with a lockfile with a single rubygems section with multiple remotes in frozen mode" do - before do - build_repo gem_repo3 do - build_gem "rack", "0.9.1" - end - - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - source "#{file_uri_for(gem_repo3)}" do - gem 'rack' - end - G - - lockfile <<~L - GEM - remote: #{file_uri_for(gem_repo1)}/ - remote: #{file_uri_for(gem_repo3)}/ - specs: - rack (0.9.1) - - PLATFORMS - ruby - - DEPENDENCIES - rack! - - BUNDLED WITH - #{Bundler::VERSION} - L - - bundle "config set --local deployment true" - end - - it "shows a deprecation", :bundler => "< 3" do - bundle "install" - - expect(deprecations).to include("Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. You should regenerate your lockfile in a non frozen environment.") - end - - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end context "when Bundler.setup is run in a ruby script" do @@ -462,14 +422,14 @@ RSpec.describe "major deprecations" do RUBY end - it "should print a capistrano deprecation warning", :bundler => "< 3" do + it "should print a capistrano deprecation warning", :bundler => "2" do expect(deprecations).to include("Bundler no longer integrates " \ "with Capistrano, but Capistrano provides " \ "its own integration with Bundler via the " \ "capistrano-bundler gem. Use it instead.") end - pending "fails with a helpful error", :bundler => "3" + pending "should fail with a helpful error", :bundler => "3" end describe Bundler::Dsl do @@ -479,7 +439,7 @@ RSpec.describe "major deprecations" do end context "with github gems" do - it "does not warn about removal", :bundler => "< 3" do + it "does not warn about removal", :bundler => "2" do expect(Bundler.ui).not_to receive(:warn) subject.gem("sparks", :github => "indirect/sparks") github_uri = "https://github.com/indirect/sparks.git" @@ -501,7 +461,7 @@ The :github git source is deprecated, and will be removed in the future. Change end context "with bitbucket gems" do - it "does not warn about removal", :bundler => "< 3" do + it "does not warn about removal", :bundler => "2" do expect(Bundler.ui).not_to receive(:warn) subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") end @@ -523,7 +483,7 @@ The :bitbucket git source is deprecated, and will be removed in the future. Add end context "with gist gems" do - it "does not warn about removal", :bundler => "< 3" do + it "does not warn about removal", :bundler => "2" do expect(Bundler.ui).not_to receive(:warn) subject.gem("not-really-a-gem", :gist => "1234") end @@ -554,7 +514,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle :show end - it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do + it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do expect(deprecations).to include("use `bundle list` instead of `bundle show`") end @@ -566,7 +526,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "show --outdated" end - it "prints a deprecation warning informing about its removal", :bundler => "< 3" do + it "prints a deprecation warning informing about its removal", :bundler => "2" do expect(deprecations).to include("the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement") end @@ -578,7 +538,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "show --verbose" end - it "prints a deprecation warning informing about its removal", :bundler => "< 3" do + it "prints a deprecation warning informing about its removal", :bundler => "2" do expect(deprecations).to include("the `--verbose` flag to `bundle show` was undocumented and will be removed without replacement") end @@ -590,7 +550,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "show rack" end - it "prints a deprecation warning recommending `bundle info`", :bundler => "< 3" do + it "prints a deprecation warning recommending `bundle info`", :bundler => "2" do expect(deprecations).to include("use `bundle info rack` instead of `bundle show rack`") end @@ -602,7 +562,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "show --paths" end - it "prints a deprecation warning recommending `bundle list`", :bundler => "< 3" do + it "prints a deprecation warning recommending `bundle list`", :bundler => "2" do expect(deprecations).to include("use `bundle list` instead of `bundle show --paths`") end @@ -614,7 +574,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "show rack --paths" end - it "prints deprecation warning recommending `bundle info`", :bundler => "< 3" do + it "prints deprecation warning recommending `bundle info`", :bundler => "2" do expect(deprecations).to include("use `bundle info rack --path` instead of `bundle show rack --paths`") end @@ -627,7 +587,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "console", :raise_on_error => false end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", :bundler => "2" do expect(deprecations).to include \ "bundle console will be replaced by `bin/console` generated by `bundle gem <name>`" end @@ -643,7 +603,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this bundle "viz" end - it "prints a deprecation warning", :bundler => "< 3" do + it "prints a deprecation warning", :bundler => "2" do expect(deprecations).to include "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz" end diff --git a/spec/bundler/support/indexes.rb b/spec/bundler/support/indexes.rb index 1f3c4ddaa6..45b68541f5 100644 --- a/spec/bundler/support/indexes.rb +++ b/spec/bundler/support/indexes.rb @@ -30,7 +30,7 @@ module Spec args[1] ||= Bundler::GemVersionPromoter.new # gem_version_promoter args[2] ||= [] # additional_base_requirements args[3] ||= @platforms # platforms - Bundler::Resolver.resolve(deps, source_requirements, *args) + Bundler::Resolver.resolve(deps, @index, source_requirements, *args) end def should_resolve_as(specs) |