diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-10-15 13:20:25 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-10-15 17:19:02 +0900 |
commit | d386a58f6f1865aaa35eda5af55cff3ff3cca4ca (patch) | |
tree | 0665fe806540deae7f8e52095af6dba70f940aa3 /spec/bundler/install/gems | |
parent | 7ffd14a18c341565afaf80d259f9fe5df8a13d29 (diff) |
Merge bundler-2.2.0.rc.2
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3659
Diffstat (limited to 'spec/bundler/install/gems')
-rw-r--r-- | spec/bundler/install/gems/compact_index_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gems/dependency_api_spec.rb | 2 | ||||
-rw-r--r-- | spec/bundler/install/gems/fund_spec.rb | 110 | ||||
-rw-r--r-- | spec/bundler/install/gems/resolving_spec.rb | 9 | ||||
-rw-r--r-- | spec/bundler/install/gems/standalone_spec.rb | 4 |
5 files changed, 121 insertions, 8 deletions
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb index 6e5177c60d..5ef3f38fe7 100644 --- a/spec/bundler/install/gems/compact_index_spec.rb +++ b/spec/bundler/install/gems/compact_index_spec.rb @@ -690,7 +690,7 @@ The checksum of /versions does not match the checksum provided by the server! So it "shows instructions if auth is not provided for the source" do bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false - expect(err).to include("bundle config set #{source_hostname} username:password") + expect(err).to include("bundle config set --global #{source_hostname} username:password") end it "fails if authentication has already been provided, but failed" do @@ -878,7 +878,7 @@ The checksum of /versions does not match the checksum provided by the server! So and include("1. delete the downloaded gem located at: `#{default_bundle_path}/gems/rack-1.0.0/rack-1.0.0.gem`"). and include("2. run `bundle install`"). and include("If you wish to continue installing the downloaded gem, and are certain it does not pose a security issue despite the mismatching checksum, do the following:"). - and include("1. run `bundle config set disable_checksum_validation true` to turn off checksum verification"). + and include("1. run `bundle config set --local disable_checksum_validation true` to turn off checksum verification"). and include("2. run `bundle install`"). and match(/\(More info: The expected SHA256 checksum was "#{"ab" * 22}", but the checksum for the downloaded gem was ".+?"\.\)/) end diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb index 765b5e5195..e92669e97c 100644 --- a/spec/bundler/install/gems/dependency_api_spec.rb +++ b/spec/bundler/install/gems/dependency_api_spec.rb @@ -664,7 +664,7 @@ RSpec.describe "gemcutter's dependency API" do it "shows instructions if auth is not provided for the source" do bundle :install, :artifice => "endpoint_strict_basic_authentication", :raise_on_error => false - expect(err).to include("bundle config set #{source_hostname} username:password") + expect(err).to include("bundle config set --global #{source_hostname} username:password") end it "fails if authentication has already been provided, but failed" do diff --git a/spec/bundler/install/gems/fund_spec.rb b/spec/bundler/install/gems/fund_spec.rb new file mode 100644 index 0000000000..57e7c3aed3 --- /dev/null +++ b/spec/bundler/install/gems/fund_spec.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +RSpec.describe "bundle install" do + context "with gem sources" do + context "when gems include a fund URI" do + it "displays the plural fund message after installing" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'has_metadata' + gem 'has_funding' + gem 'rack-obama' + G + + expect(out).to include("2 installed gems you directly depend on are looking for funding.") + end + + it "displays the singular fund message after installing" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'has_funding' + gem 'rack-obama' + G + + expect(out).to include("1 installed gem you directly depend on is looking for funding.") + end + end + + context "when gems do not include fund messages" do + it "does not display any fund messages" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "activesupport" + G + + expect(out).not_to include("gem you depend on") + end + end + + context "when a dependency includes a fund message" do + it "does not display the fund message" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'gem_with_dependent_funding' + G + + expect(out).not_to include("gem you depend on") + end + end + end + + context "with git sources" do + context "when gems include fund URI" do + it "displays the fund message after installing" do + build_git "also_has_funding" do |s| + s.metadata = { + "funding_uri" => "https://example.com/also_has_funding/funding", + } + end + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' + G + + expect(out).to include("1 installed gem you directly depend on is looking for funding.") + end + + it "displays the fund message if repo is updated" do + build_git "also_has_funding" do |s| + s.metadata = { + "funding_uri" => "https://example.com/also_has_funding/funding", + } + end + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' + G + + build_git "also_has_funding", "1.1" do |s| + s.metadata = { + "funding_uri" => "https://example.com/also_has_funding/funding", + } + end + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.1")}' + G + + expect(out).to include("1 installed gem you directly depend on is looking for funding.") + end + + it "displays the fund message if repo is not updated" do + build_git "also_has_funding" do |s| + s.metadata = { + "funding_uri" => "https://example.com/also_has_funding/funding", + } + end + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'also_has_funding', :git => '#{lib_path("also_has_funding-1.0")}' + G + + bundle :install + expect(out).to include("1 installed gem you directly depend on is looking for funding.") + + bundle :install + expect(out).to include("1 installed gem you directly depend on is looking for funding.") + end + end + end +end diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb index f72220ef21..f621b01366 100644 --- a/spec/bundler/install/gems/resolving_spec.rb +++ b/spec/bundler/install/gems/resolving_spec.rb @@ -107,10 +107,13 @@ RSpec.describe "bundle install with install-time dependencies" do bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" } + activated_groups = "net_b (1.0) (ruby)" + activated_groups += ", net_b (1.0) (#{local_platforms.join(", ")})" if local_platforms.any? && local_platforms != ["ruby"] + expect(err).to include(" net_b"). and include("BUNDLER: Starting resolution"). and include("BUNDLER: Finished resolution"). - and include("Attempting to activate") + and include("Attempting to activate [#{activated_groups}]") end end end @@ -233,7 +236,7 @@ RSpec.describe "bundle install with install-time dependencies" do describe "with a < requirement" do let(:ruby_requirement) { %("< 5000") } - let(:error_message_requirement) { Gem::Requirement.new(["< 5000", "= #{Bundler::RubyVersion.system.to_gem_version_with_patchlevel}"]).to_s } + let(:error_message_requirement) { "< 5000" } it_behaves_like "ruby version conflicts" end @@ -241,7 +244,7 @@ RSpec.describe "bundle install with install-time dependencies" do describe "with a compound requirement" do let(:reqs) { ["> 0.1", "< 5000"] } let(:ruby_requirement) { reqs.map(&:dump).join(", ") } - let(:error_message_requirement) { Gem::Requirement.new(reqs + ["= #{Bundler::RubyVersion.system.to_gem_version_with_patchlevel}"]).to_s } + let(:error_message_requirement) { Gem::Requirement.new(reqs).to_s } it_behaves_like "ruby version conflicts" end diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb index 503cc4a4f0..02452f1ef6 100644 --- a/spec/bundler/install/gems/standalone_spec.rb +++ b/spec/bundler/install/gems/standalone_spec.rb @@ -81,8 +81,8 @@ RSpec.shared_examples "bundle install --standalone" do it "generates a bundle/bundler/setup.rb with the proper paths" do expected_path = bundled_app("bundle/bundler/setup.rb") extension_line = File.read(expected_path).each_line.find {|line| line.include? "/extensions/" }.strip - expect(extension_line).to start_with '$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/' - expect(extension_line).to end_with '/very_simple_binary-1.0"' + expect(extension_line).to start_with '$:.unshift File.expand_path("#{path}/../#{ruby_engine}/#{ruby_version}/extensions/' + expect(extension_line).to end_with '/very_simple_binary-1.0")' end end |