summaryrefslogtreecommitdiff
path: root/spec/bundler/install
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-14 06:01:35 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-14 06:01:35 +0000
commit68ddd4d300e9a88737c4f37af74e1a0312949b2f (patch)
tree787e1e83d76934ce039eb336995a8d5bb53a89e6 /spec/bundler/install
parentd636809c057432e8d42abe30c6c6785eb0721d77 (diff)
Merge Bundler 2.1.0.pre.1 as developed version from upstream.
https://github.com/bundler/bundler/commit/a53709556b95a914e874b22ed2116a46b0528852 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/install')
-rw-r--r--spec/bundler/install/allow_offline_install_spec.rb10
-rw-r--r--spec/bundler/install/binstubs_spec.rb21
-rw-r--r--spec/bundler/install/bundler_spec.rb14
-rw-r--r--spec/bundler/install/deploy_spec.rb126
-rw-r--r--spec/bundler/install/failure_spec.rb19
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb123
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb206
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb8
-rw-r--r--spec/bundler/install/gemfile/lockfile_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb40
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb11
-rw-r--r--spec/bundler/install/gemfile/ruby_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb147
-rw-r--r--spec/bundler/install/gemfile/specific_platform_spec.rb2
-rw-r--r--spec/bundler/install/gemfile_spec.rb27
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb44
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb28
-rw-r--r--spec/bundler/install/gems/flex_spec.rb12
-rw-r--r--spec/bundler/install/gems/mirror_spec.rb4
-rw-r--r--spec/bundler/install/gems/native_extensions_spec.rb45
-rw-r--r--spec/bundler/install/gems/post_install_spec.rb4
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb37
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb6
-rw-r--r--spec/bundler/install/gems/sudo_spec.rb18
-rw-r--r--spec/bundler/install/gemspecs_spec.rb19
-rw-r--r--spec/bundler/install/git_spec.rb2
-rw-r--r--spec/bundler/install/global_cache_spec.rb10
-rw-r--r--spec/bundler/install/path_spec.rb16
-rw-r--r--spec/bundler/install/post_bundle_message_spec.rb14
-rw-r--r--spec/bundler/install/process_lock_spec.rb2
-rw-r--r--spec/bundler/install/redownload_spec.rb14
-rw-r--r--spec/bundler/install/security_policy_spec.rb13
-rw-r--r--spec/bundler/install/yanked_spec.rb14
33 files changed, 603 insertions, 457 deletions
diff --git a/spec/bundler/install/allow_offline_install_spec.rb b/spec/bundler/install/allow_offline_install_spec.rb
index d4bb595771..8af88b7efe 100644
--- a/spec/bundler/install/allow_offline_install_spec.rb
+++ b/spec/bundler/install/allow_offline_install_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with :allow_offline_install" do
before do
- bundle "config allow_offline_install true"
+ bundle "config set allow_offline_install true"
end
context "with no cached data locally" do
@@ -19,7 +19,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
source "http://testgemserver.local"
gem "rack-obama"
G
- expect(out).to include("Could not reach host testgemserver.local.")
+ expect(err).to include("Could not reach host testgemserver.local.")
expect(the_bundle).to_not be_locked
end
end
@@ -28,7 +28,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
it "will install from the compact index" do
system_gems ["rack-1.0.0"], :path => :bundle_path
- bundle! "config clean false"
+ bundle! "config set clean false"
install_gemfile! <<-G, :artifice => "compact_index"
source "http://testgemserver.local"
gem "rack-obama"
@@ -77,7 +77,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
G
break_git_remote_ops! { bundle! :update, :all => true }
- expect(out).to include("Using cached git data because of network errors")
+ expect(err).to include("Using cached git data because of network errors")
expect(the_bundle).to be_locked
break_git_remote_ops! do
@@ -85,7 +85,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
gem "a", :git => #{git.path.to_s.dump}, :branch => "new_branch"
G
end
- expect(out).to include("Using cached git data because of network errors")
+ expect(err).to include("Using cached git data because of network errors")
expect(the_bundle).to be_locked
end
end
diff --git a/spec/bundler/install/binstubs_spec.rb b/spec/bundler/install/binstubs_spec.rb
index f04d3fe654..daa20693c7 100644
--- a/spec/bundler/install/binstubs_spec.rb
+++ b/spec/bundler/install/binstubs_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install", :bundler => "< 3" do
+RSpec.describe "bundle install" do
describe "when system_bindir is set" do
# On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
# you want to avoid sudo installs for system gems with OS X's default ruby
@@ -20,7 +20,7 @@ RSpec.describe "bundle install", :bundler => "< 3" do
end
end
- describe "when multiple gems contain the same exe", :bundler => "< 3" do
+ describe "when multiple gems contain the same exe" do
before do
build_repo2 do
build_gem "fake", "14" do |s|
@@ -28,16 +28,25 @@ RSpec.describe "bundle install", :bundler => "< 3" do
end
end
- install_gemfile <<-G, :binstubs => true
+ install_gemfile <<-G
source "file://#{gem_repo2}"
gem "fake"
gem "rack"
G
end
- it "loads the correct spec's executable" do
- gembin("rackup")
- expect(out).to eq("1.2")
+ it "warns about the situation" do
+ bundle! "exec rackup"
+
+ expect(last_command.stderr).to include(
+ "The `rackup` executable in the `fake` gem is being loaded, but it's also present in other gems (rack).\n" \
+ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
+ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
+ ).or include(
+ "The `rackup` executable in the `rack` gem is being loaded, but it's also present in other gems (fake).\n" \
+ "If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
+ "If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
+ )
end
end
end
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index 42863ed89b..3347988cdd 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -125,8 +125,8 @@ RSpec.describe "bundle install" do
expect(last_command.bundler_err).to include(nice_error)
end
- it "can install dependencies with newer bundler version with system gems", :ruby => "> 2" do
- bundle! "config path.system true"
+ it "can install dependencies with newer bundler version with system gems" do
+ bundle! "config set path.system true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "rails", "3.0"
@@ -138,9 +138,9 @@ RSpec.describe "bundle install" do
expect(out).to include("The Gemfile's dependencies are satisfied")
end
- it "can install dependencies with newer bundler version with a local path", :ruby => "> 2" do
- bundle! "config path .bundle"
- bundle! "config global_path_appends_ruby_scope true"
+ it "can install dependencies with newer bundler version with a local path" do
+ bundle! "config set path .bundle"
+ bundle! "config set global_path_appends_ruby_scope true"
install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "rails", "3.0"
@@ -153,7 +153,7 @@ RSpec.describe "bundle install" do
end
context "with allow_bundler_dependency_conflicts set" do
- before { bundle! "config allow_bundler_dependency_conflicts true" }
+ before { bundle! "config set allow_bundler_dependency_conflicts true" }
it "are forced to the current bundler version with warnings when no compatible version is found" do
build_repo4 do
@@ -167,7 +167,7 @@ RSpec.describe "bundle install" do
gem "requires_nonexistant_bundler"
G
- expect(out).to include "requires_nonexistant_bundler (1.0) has dependency bundler (= 99.99.99.99), " \
+ expect(err).to include "requires_nonexistant_bundler (1.0) has dependency bundler (= 99.99.99.99), " \
"which is unsatisfied by the current bundler version #{Bundler::VERSION}, so the dependency is being ignored"
expect(the_bundle).to include_gems "bundler #{Bundler::VERSION}", "requires_nonexistant_bundler 1.0"
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index ec72ff69fc..918dbabfbe 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -11,26 +11,26 @@ RSpec.describe "install with --deployment or --frozen" do
context "with CLI flags", :bundler => "< 3" do
it "fails without a lockfile and says that --deployment requires a lock" do
bundle "install --deployment"
- expect(out).to include("The --deployment flag requires a Gemfile.lock")
+ expect(err).to include("The --deployment flag requires a Gemfile.lock")
end
it "fails without a lockfile and says that --frozen requires a lock" do
bundle "install --frozen"
- expect(out).to include("The --frozen flag requires a Gemfile.lock")
+ expect(err).to include("The --frozen flag requires a Gemfile.lock")
end
it "disallows --deployment --system" do
bundle "install --deployment --system"
- expect(out).to include("You have specified both --deployment")
- expect(out).to include("Please choose only one option")
+ expect(err).to include("You have specified both --deployment")
+ expect(err).to include("Please choose only one option")
expect(exitstatus).to eq(15) if exitstatus
end
it "disallows --deployment --path --system" do
bundle "install --deployment --path . --system"
- expect(out).to include("You have specified both --path")
- expect(out).to include("as well as --system")
- expect(out).to include("Please choose only one option")
+ expect(err).to include("You have specified both --path")
+ expect(err).to include("as well as --system")
+ expect(err).to include("Please choose only one option")
expect(exitstatus).to eq(15) if exitstatus
end
@@ -129,11 +129,11 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "works if a path gem is missing but is in a without group" do
@@ -162,7 +162,7 @@ RSpec.describe "install with --deployment or --frozen" do
FileUtils.rm_r lib_path("path_gem-1.0")
bundle :install, forgotten_command_line_options(:path => ".bundle", :deployment => true)
- expect(out).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
+ expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end
it "can have --frozen set via an environment variable", :bundler => "< 3" do
@@ -174,11 +174,11 @@ RSpec.describe "install with --deployment or --frozen" do
ENV["BUNDLE_FROZEN"] = "1"
bundle "install"
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "can have --deployment set via an environment variable" do
@@ -190,11 +190,11 @@ RSpec.describe "install with --deployment or --frozen" do
ENV["BUNDLE_DEPLOYMENT"] = "true"
bundle "install"
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile")
+ expect(err).to include("* rack-obama")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "can have --frozen set to false via an environment variable" do
@@ -212,21 +212,6 @@ RSpec.describe "install with --deployment or --frozen" do
expect(out).not_to include("* rack-obama")
end
- it "explodes with the --frozen flag if you make a change and don't check in the lockfile", :bundler => "< 2" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- gem "rack-obama", "1.1"
- G
-
- bundle :install, forgotten_command_line_options(:frozen => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile")
- expect(out).to include("* rack-obama (= 1.1)")
- expect(out).not_to include("You have deleted from the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
- end
-
it "explodes if you remove a gem and don't check in the lockfile" do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -234,10 +219,10 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile:\n* activesupport\n\n")
- expect(out).to include("You have deleted from the Gemfile:\n* rack")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
+ expect(err).to include("You have deleted from the Gemfile:\n* rack")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you add a source" do
@@ -247,9 +232,9 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you unpin a source" do
@@ -266,10 +251,10 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
- expect(out).not_to include("You have added to the Gemfile")
- expect(out).not_to include("You have changed in the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have changed in the Gemfile")
end
it "explodes if you unpin a source, leaving it pinned somewhere else" do
@@ -289,19 +274,15 @@ RSpec.describe "install with --deployment or --frozen" do
G
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("deployment mode")
- expect(out).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
- expect(out).not_to include("You have added to the Gemfile")
- expect(out).not_to include("You have deleted from the Gemfile")
+ expect(err).to include("deployment mode")
+ expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have deleted from the Gemfile")
end
context "when replacing a host with the same host with credentials" do
let(:success_message) do
- if Bundler.bundler_major_version < 3
- "Could not reach host localgemserver.test"
- else
- "Bundle complete!"
- end
+ "Bundle complete!"
end
before do
@@ -322,31 +303,33 @@ RSpec.describe "install with --deployment or --frozen" do
DEPENDENCIES
rack
G
+
+ bundle! "config set --local deployment true"
end
it "prevents the replace by default" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
context "when allow_deployment_source_credential_changes is true" do
- before { bundle! "config allow_deployment_source_credential_changes true" }
+ before { bundle! "config set allow_deployment_source_credential_changes true" }
it "allows the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
expect(out).to match(/#{success_message}/)
end
end
context "when allow_deployment_source_credential_changes is false" do
- before { bundle! "config allow_deployment_source_credential_changes false" }
+ before { bundle! "config set allow_deployment_source_credential_changes false" }
it "prevents the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
end
@@ -354,7 +337,7 @@ RSpec.describe "install with --deployment or --frozen" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "true" }
it "allows the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
expect(out).to match(/#{success_message}/)
end
@@ -364,9 +347,9 @@ RSpec.describe "install with --deployment or --frozen" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
it "prevents the replace" do
- bundle :install, forgotten_command_line_options(:deployment => true)
+ bundle :install
- expect(out).to match(/The list of sources changed/)
+ expect(err).to match(/The list of sources changed/)
end
end
end
@@ -374,7 +357,7 @@ RSpec.describe "install with --deployment or --frozen" do
it "remembers that the bundle is frozen at runtime" do
bundle! :lock
- bundle! "config deployment true"
+ bundle! "config set --local deployment true"
gemfile <<-G
source "file://#{gem_repo1}"
@@ -383,7 +366,7 @@ RSpec.describe "install with --deployment or --frozen" do
G
expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(err).to include strip_whitespace(<<-E).strip
+ expect(last_command.stderr).to include strip_whitespace(<<-E).strip
The dependencies in your gemfile changed
You have added to the Gemfile:
@@ -412,7 +395,8 @@ You have deleted from the Gemfile:
expect(out).to include("Updating files in vendor/cache")
simulate_new_machine
- bundle! "install --verbose", forgotten_command_line_options(:deployment => true)
+ bundle! "config set --local deployment true"
+ bundle! "install --verbose"
expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile")
expect(out).not_to include("You have added to the Gemfile")
expect(out).not_to include("You have deleted from the Gemfile")
diff --git a/spec/bundler/install/failure_spec.rb b/spec/bundler/install/failure_spec.rb
index b4cdf13857..49e2771dca 100644
--- a/spec/bundler/install/failure_spec.rb
+++ b/spec/bundler/install/failure_spec.rb
@@ -121,5 +121,24 @@ In Gemfile:
activesupport
M
end
+
+ context "because the downloaded .gem was invalid" do
+ before do
+ build_repo4 do
+ build_gem "a"
+ end
+
+ gem_repo4("gems", "a-1.0.gem").open("w") {|f| f << "<html></html>" }
+ end
+
+ it "removes the downloaded .gem" do
+ install_gemfile <<-G
+ source "file:#{gem_repo4}"
+ gem "a"
+ G
+
+ expect(default_bundle_path("cache", "a-1.0.gem")).not_to exist
+ end
+ end
end
end
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index bbb56da5a4..0bec2e9d96 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "bundle install from an existing gemspec" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec")
s.add_dependency "actionpack", "=2.3.2"
- s.add_development_dependency "rake", "=10.0.2"
+ s.add_development_dependency "rake", "=12.3.2"
end
Dir.chdir(tmp.join("foo")) do
@@ -239,7 +239,7 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(the_bundle).to include_gems "foo 1.0.0"
end
- it "does not break Gem.finish_resolve with conflicts", :rubygems => ">= 2" do
+ it "does not break Gem.finish_resolve with conflicts" do
build_lib("foo", :path => tmp.join("foo")) do |s|
s.version = "1.0.0"
s.add_dependency "bar", "= 1.0.0"
@@ -263,6 +263,20 @@ RSpec.describe "bundle install from an existing gemspec" do
expect(out).to eq("WIN")
end
+ it "works with only_update_to_newer_versions" do
+ build_lib "omg", "2.0", :path => lib_path("omg")
+
+ install_gemfile <<-G
+ gemspec :path => "#{lib_path("omg")}"
+ G
+
+ build_lib "omg", "1.0", :path => lib_path("omg")
+
+ bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }
+
+ expect(the_bundle).to include_gems "omg 1.0"
+ end
+
context "in deployment mode" do
context "when the lockfile was not updated after a change to the gemspec's dependencies" do
it "reports that installation failed" do
@@ -283,7 +297,7 @@ RSpec.describe "bundle install from an existing gemspec" do
bundle :install, forgotten_command_line_options(:deployment => true)
- expect(out).to include("changed")
+ expect(err).to include("changed")
end
end
end
@@ -433,7 +447,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
- context "on ruby", :bundler => "< 3" do
+ context "on ruby" do
before do
simulate_platform("ruby")
bundle :install
@@ -533,107 +547,6 @@ RSpec.describe "bundle install from an existing gemspec" do
end
end
end
-
- context "on ruby", :bundler => "3" do
- before do
- simulate_platform("ruby")
- bundle :install
- end
-
- context "as a runtime dependency" do
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
- platform_specific
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
-
- context "as a development dependency" do
- let(:platform_specific_type) { :development }
-
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
- platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
-
- context "with an indirect platform-specific development dependency" do
- let(:platform_specific_type) { :development }
- let(:dependency) { "indirect_platform_specific" }
-
- it "keeps java dependencies in the lockfile" do
- expect(the_bundle).to include_gems "foo 1.0", "indirect_platform_specific 1.0", "platform_specific 1.0 RUBY"
- expect(lockfile).to eq normalize_uri_file(strip_whitespace(<<-L))
- GEM
- remote: file://localhost#{gem_repo2}/
- specs:
- indirect_platform_specific (1.0)
- platform_specific
- platform_specific (1.0)
- platform_specific (1.0-java)
-
- PATH
- remote: .
- specs:
- foo (1.0)
-
- PLATFORMS
- java
- ruby
-
- DEPENDENCIES
- foo!
- indirect_platform_specific
-
- BUNDLED WITH
- #{Bundler::VERSION}
- L
- end
- end
- end
end
end
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index fe396c7a0f..f208853041 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe "bundle install with git sources" do
it "caches the git repo globally" do
simulate_new_machine
- bundle! "config global_gem_cache true"
+ bundle! "config set global_gem_cache true"
bundle! :install
expect(Dir["#{home}/.bundle/cache/git/foo-1.0-*"]).to have_attributes :size => 1
end
@@ -87,7 +87,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G
- expect(out).to include("The source contains 'foo' at: 1.0")
+ expect(err).to include("The source contains 'foo' at: 1.0")
end
it "complains with version and platform if pinned specs don't exist in the git repo" do
@@ -103,7 +103,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(out).to include("The source contains 'only_java' at: 1.0 java")
+ expect(err).to include("The source contains 'only_java' at: 1.0 java")
end
it "complains with multiple versions and platforms if pinned specs don't exist in the git repo" do
@@ -124,7 +124,7 @@ RSpec.describe "bundle install with git sources" do
end
G
- expect(out).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
+ expect(err).to include("The source contains 'only_java' at: 1.0 java, 1.1 java")
end
it "still works after moving the application directory" do
@@ -204,7 +204,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run <<-RUBY
require 'foo'
@@ -221,7 +221,7 @@ RSpec.describe "bundle install with git sources" do
end
Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1`
+ `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
end
# want to ensure we don't fallback to HEAD
@@ -234,7 +234,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run! <<-RUBY
require 'foo'
@@ -257,7 +257,7 @@ RSpec.describe "bundle install with git sources" do
end
Dir.chdir(lib_path("foo-1.0")) do
- `git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1`
+ `git update-ref -m "Bundler Spec!" refs/bundler/1 master~1`
end
# want to ensure we don't fallback to HEAD
@@ -270,7 +270,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
run! <<-RUBY
require 'foo'
@@ -282,10 +282,10 @@ RSpec.describe "bundle install with git sources" do
it "does not download random non-head refs" do
Dir.chdir(lib_path("foo-1.0")) do
- sys_exec!("git update-ref -m 'Bundler Spec!' refs/bundler/1 master~1")
+ sys_exec!('git update-ref -m "Bundler Spec!" refs/bundler/1 master~1')
end
- bundle! "config global_gem_cache true"
+ bundle! "config set global_gem_cache true"
install_gemfile! <<-G
git "#{lib_path("foo-1.0")}" do
@@ -294,7 +294,7 @@ RSpec.describe "bundle install with git sources" do
G
# ensure we also git fetch after cloning
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
Dir.chdir(Dir[home(".bundle/cache/git/foo-*")].first) do
sys_exec("git ls-remote .")
@@ -406,7 +406,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle! %(config local.rack #{lib_path("local-rack")})
+ bundle! %(config set local.rack #{lib_path("local-rack")})
bundle! :install
run "require 'rack'"
@@ -427,7 +427,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
expect(out).to eq("LOCAL")
end
@@ -447,7 +447,7 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle! %(config local.rack #{lib_path("local-rack")})
+ bundle! %(config set local.rack #{lib_path("local-rack")})
bundle! :install
run! "require 'rack'"
expect(out).to eq("LOCAL")
@@ -470,7 +470,7 @@ RSpec.describe "bundle install with git sources" do
s.add_dependency "nokogiri", "1.4.2"
end
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
lockfile1 = File.read(bundled_app("Gemfile.lock"))
@@ -490,14 +490,14 @@ RSpec.describe "bundle install with git sources" do
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
update_git "rack", "0.8", :path => lib_path("local-rack")
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
lockfile1 = File.read(bundled_app("Gemfile.lock"))
expect(lockfile1).not_to eq(lockfile0)
end
- it "explodes if given path does not exist on install" do
+ it "explodes and gives correct solution if given path does not exist on install" do
build_git "rack", "0.8"
install_gemfile <<-G
@@ -505,12 +505,20 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+ expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+
+ solution = "config unset local.rack"
+ expect(err).to match(/Run `bundle #{solution}` to remove the local override/)
+
+ bundle solution
+ bundle :install
+
+ expect(last_command.stderr).to be_empty
end
- it "explodes if branch is not given on install" do
+ it "explodes and gives correct solution if branch is not given on install" do
build_git "rack", "0.8"
FileUtils.cp_r("#{lib_path("rack-0.8")}/.", lib_path("local-rack"))
@@ -519,9 +527,17 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
+ bundle :install
+ expect(err).to match(/Cannot use local override for rack-0.8 at #{Regexp.escape(lib_path('local-rack').to_s)} because :branch is not specified in Gemfile/)
+
+ solution = "config unset local.rack"
+ expect(err).to match(/Specify a branch or run `bundle #{solution}` to remove the local override/)
+
+ bundle solution
bundle :install
- expect(out).to match(/cannot use local override/i)
+
+ expect(last_command.stderr).to be_empty
end
it "does not explode if disable_local_branch_check is given" do
@@ -533,8 +549,8 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
- bundle %(config local.rack #{lib_path("local-rack")})
- bundle %(config disable_local_branch_check true)
+ bundle %(config set local.rack #{lib_path("local-rack")})
+ bundle %(config set disable_local_branch_check true)
bundle :install
expect(out).to match(/Bundle complete!/)
end
@@ -553,9 +569,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/is using branch another but Gemfile specifies master/)
+ expect(err).to match(/is using branch another but Gemfile specifies master/)
end
it "explodes on invalid revision on install" do
@@ -570,9 +586,9 @@ RSpec.describe "bundle install with git sources" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master"
G
- bundle %(config local.rack #{lib_path("local-rack")})
+ bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
- expect(out).to match(/The Gemfile lock is pointing to revision \w+/)
+ expect(err).to match(/The Gemfile lock is pointing to revision \w+/)
end
end
@@ -709,7 +725,7 @@ RSpec.describe "bundle install with git sources" do
build_lib "bar", :path => lib_path("foo/bar"), :gemspec => false do |s|
s.write lib_path("foo/bar/lib/version.rb"), %(BAR_VERSION = '1.0')
s.write "bar.gemspec", <<-G
- $:.unshift Dir.pwd # For 1.9
+ $:.unshift Dir.pwd
require 'lib/version'
Gem::Specification.new do |s|
s.name = 'bar'
@@ -769,7 +785,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install
- expect(out).to include("Git error:")
+ expect(err).to include("Git error:")
expect(err).to include("fatal")
expect(err).to include("omgomg")
end
@@ -798,14 +814,14 @@ RSpec.describe "bundle install with git sources" do
s.write "lib/forced.rb", "FORCED = '1.1'"
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.1"
Dir.chdir(lib_path("forced-1.0")) do
`git reset --hard HEAD^`
end
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.0"
end
@@ -824,7 +840,7 @@ RSpec.describe "bundle install with git sources" do
gem "has_submodule"
end
G
- expect(out).to match(/could not find gem 'submodule/i)
+ expect(err).to match(/could not find gem 'submodule/i)
expect(the_bundle).not_to include_gems "has_submodule 1.0"
end
@@ -910,7 +926,7 @@ RSpec.describe "bundle install with git sources" do
G
expect(exitstatus).to_not eq(0) if exitstatus
- expect(out).to include("Bundler could not install a gem because it " \
+ expect(err).to include("Bundler could not install a gem because it " \
"needs to create a directory, but a file exists " \
"- #{default_bundle_path("bundler")}")
end
@@ -922,12 +938,11 @@ RSpec.describe "bundle install with git sources" do
build_git "foo", :path => lib_path("nested")
build_git "bar", :path => lib_path("nested")
- gemfile <<-G
+ install_gemfile <<-G
gem "foo", :git => "#{lib_path("nested")}"
gem "bar", :git => "#{lib_path("nested")}"
G
- bundle "install"
expect(File.read(bundled_app("Gemfile.lock")).scan("GIT").size).to eq(1)
end
@@ -1010,14 +1025,12 @@ RSpec.describe "bundle install with git sources" do
install_gemfile <<-G
gem "foo", :git => "file://#{lib_path("foo-1.0")}", :ref => "#{revision}"
G
- bundle "install"
expect(out).to_not match(/Revision.*does not exist/)
install_gemfile <<-G
gem "foo", :git => "file://#{lib_path("foo-1.0")}", :ref => "deadbeef"
G
- bundle "install"
- expect(out).to include("Revision deadbeef does not exist in the repository")
+ expect(err).to include("Revision deadbeef does not exist in the repository")
end
end
@@ -1054,7 +1067,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -1074,7 +1087,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
@@ -1094,7 +1107,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(out).to include("failed for foo-1.0")
+ expect(err).to include("failed for foo-1.0")
end
end
@@ -1150,7 +1163,7 @@ RSpec.describe "bundle install with git sources" do
void Init_foo() { rb_define_global_function("foo", &foo, 0); }
C
end
- `git commit -m 'commit for iteration #{i}' ext/foo.c`
+ `git commit -m "commit for iteration #{i}" ext/foo.c`
end
git_commit_sha = git_reader.ref_for("HEAD")
@@ -1193,7 +1206,48 @@ In Gemfile:
expect(out).not_to include("gem install foo")
end
- it "does not reinstall the extension", :ruby_repo, :rubygems => ">= 2.3.0" do
+ it "does not reinstall the extension", :ruby_repo do
+ build_git "foo" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ cur_time = Time.now.to_f.to_s
+ File.open("\#{path}/foo.rb", "w") do |f|
+ f.puts "FOO = \#{cur_time}"
+ end
+ end
+ RUBY
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+
+ installed_time = out
+ expect(installed_time).to match(/\A\d+\.\d+\z/)
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).to eq(installed_time)
+ end
+
+ it "does not reinstall the extension when changing another gem" do
build_git "foo" do |s|
s.add_dependency "rake"
s.extensions << "Rakefile"
@@ -1211,6 +1265,7 @@ In Gemfile:
install_gemfile <<-G
source "file://#{gem_repo1}"
+ gem "rack", "0.9.1"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1224,6 +1279,7 @@ In Gemfile:
install_gemfile <<-G
source "file://#{gem_repo1}"
+ gem "rack", "1.0.0"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@@ -1233,6 +1289,60 @@ In Gemfile:
R
expect(out).to eq(installed_time)
end
+
+ it "does reinstall the extension when changing refs" do
+ build_git "foo" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ path = File.expand_path("../lib", __FILE__)
+ FileUtils.mkdir_p(path)
+ cur_time = Time.now.to_f.to_s
+ File.open("\#{path}/foo.rb", "w") do |f|
+ f.puts "FOO = \#{cur_time}"
+ end
+ end
+ RUBY
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+
+ update_git("foo", :branch => "branch2")
+
+ installed_time = out
+ expect(installed_time).to match(/\A\d+\.\d+\z/)
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path("foo-1.0")}", :branch => "branch2"
+ G
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).not_to eq(installed_time)
+
+ installed_time = out
+
+ update_git("foo")
+ bundle! "update foo"
+
+ run! <<-R
+ require 'foo'
+ puts FOO
+ R
+ expect(out).not_to eq(installed_time)
+ end
end
it "ignores git environment variables" do
@@ -1268,7 +1378,7 @@ In Gemfile:
G
with_path_as("") do
- bundle "update", :all => bundle_update_requires_all?
+ bundle "update", :all => true
end
expect(last_command.bundler_err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
@@ -1292,7 +1402,7 @@ In Gemfile:
describe "when the git source is overridden with a local git repo" do
before do
- bundle! "config --global local.foo #{lib_path("foo")}"
+ bundle! "config set --global local.foo #{lib_path("foo")}"
end
describe "and git output is colorized" do
@@ -1326,7 +1436,6 @@ In Gemfile:
end
G
- bundle :install
expect(last_command.stdboth).to_not include("password1")
expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo")
end
@@ -1342,7 +1451,6 @@ In Gemfile:
end
G
- bundle :install
expect(last_command.stdboth).to_not include("oauth_token")
expect(last_command.stdout).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
end
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 45395e606f..f836499148 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe "bundle install with groups" do
puts ACTIVESUPPORT
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "installs gems with inline :groups into those groups" do
@@ -36,7 +36,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
R
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up everything if Bundler.setup is used with no groups" do
@@ -57,7 +57,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
RUBY
- expect(err).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up old groups when they have previously been removed" do
@@ -207,7 +207,7 @@ RSpec.describe "bundle install with groups" do
it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do
bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo")
expect(last_command).to be_failure
- expect(out).to include("The offending groups are: emo")
+ expect(err).to include("The offending groups are: emo")
end
it "allows the BUNDLE_WITH setting to override BUNDLE_WITHOUT" do
diff --git a/spec/bundler/install/gemfile/lockfile_spec.rb b/spec/bundler/install/gemfile/lockfile_spec.rb
index dc1baca6ea..96cd5067be 100644
--- a/spec/bundler/install/gemfile/lockfile_spec.rb
+++ b/spec/bundler/install/gemfile/lockfile_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "bundle install with a lockfile present" do
context "with plugins disabled" do
before do
- bundle! "config plugins false"
+ bundle! "config set plugins false"
subject
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index a508c971ad..54a41b576f 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -66,8 +66,8 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', :path => "~#{username}/#{relative_path}"
G
- expect(out).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
- expect(out).to match("user #{username} doesn't exist")
+ expect(err).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
+ expect(err).to match("user #{username} doesn't exist")
end
it "expands paths relative to Bundler.root" do
@@ -132,6 +132,20 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "foo 1.0"
end
+ it "works with only_update_to_newer_versions" do
+ build_lib "omg", "2.0", :path => lib_path("omg")
+
+ install_gemfile <<-G
+ gem "omg", :path => "#{lib_path("omg")}"
+ G
+
+ build_lib "omg", "1.0", :path => lib_path("omg")
+
+ bundle! :install, :env => { "BUNDLE_BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS" => "true" }
+
+ expect(the_bundle).to include_gems "omg 1.0"
+ end
+
it "prefers gemspecs closer to the path root" do
build_lib "premailer", "1.0.0", :path => lib_path("premailer") do |s|
s.write "gemfiles/ruby187.gemspec", <<-G
@@ -153,7 +167,7 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "premailer 1.0.0"
end
- it "warns on invalid specs", :rubygems => "1.7" do
+ it "warns on invalid specs" do
build_lib "foo"
gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s
@@ -169,11 +183,11 @@ RSpec.describe "bundle install with explicit source paths" do
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
- expect(out).to_not include("ERROR REPORT")
- expect(out).to_not include("Your Gemfile has no gem server sources.")
- expect(out).to match(/is not valid. Please fix this gemspec./)
- expect(out).to match(/The validation error was 'missing value for attribute version'/)
- expect(out).to match(/You have one or more invalid gemspecs that need to be fixed/)
+ expect(err).to_not include("ERROR REPORT")
+ expect(err).to_not include("Your Gemfile has no gem server sources.")
+ expect(err).to match(/is not valid. Please fix this gemspec./)
+ expect(err).to match(/The validation error was 'missing value for attribute version'/)
+ expect(err).to match(/You have one or more invalid gemspecs that need to be fixed/)
end
it "supports gemspec syntax" do
@@ -260,7 +274,7 @@ RSpec.describe "bundle install with explicit source paths" do
G
expect(exitstatus).to eq(15) if exitstatus
- expect(out).to match(/There are multiple gemspecs/)
+ expect(err).to match(/There are multiple gemspecs/)
end
it "allows :name to be specified to resolve ambiguity" do
@@ -299,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "removes the .gem file after installing" do
@@ -561,7 +575,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -581,7 +595,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
@@ -601,7 +615,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(out).to include("failed for foo-1.0")
+ expect(err).to include("failed for foo-1.0")
end
it "loads plugins from the path gem" do
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index b5dbc41a33..891f766cc0 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -248,9 +248,9 @@ RSpec.describe "bundle install across platforms" do
gem "facter"
G
- expect(out).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \
+ expect(err).to include "Unable to use the platform-specific (universal-darwin) version of facter (2.4.6) " \
"because it has different dependencies from the ruby version. " \
- "To use the platform-specific version of the gem, run `bundle config specific_platform true` and install again."
+ "To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
expect(the_bundle).to include_gem "facter 2.4.6"
expect(the_bundle).not_to include_gem "CFPropertyList"
@@ -265,8 +265,7 @@ RSpec.describe "bundle install across platforms" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- new_version = Gem::ConfigMap[:ruby_version] == "1.8" ? "1.9.1" : "1.8"
- FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, new_version))
+ FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8"))
bundle! :install
expect(vendored_gems("gems/rack-1.0.0")).to exist
@@ -385,13 +384,13 @@ RSpec.describe "bundle install with platform conditionals" do
bundle! "install"
- expect(out).to include <<-O.strip
+ expect(err).to include <<-O.strip
The dependency #{Gem::Dependency.new("rack", ">= 0")} will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
O
end
context "when disable_platform_warnings is true" do
- before { bundle! "config disable_platform_warnings true" }
+ before { bundle! "config set disable_platform_warnings true" }
it "does not print the warning when a dependency is unused on any platform" do
simulate_platform "ruby"
diff --git a/spec/bundler/install/gemfile/ruby_spec.rb b/spec/bundler/install/gemfile/ruby_spec.rb
index 24fe021fa3..3373c9bd3e 100644
--- a/spec/bundler/install/gemfile/ruby_spec.rb
+++ b/spec/bundler/install/gemfile/ruby_spec.rb
@@ -103,6 +103,6 @@ RSpec.describe "ruby requirement" do
gem "rack"
G
- expect(out).to include("There was an error parsing") # i.e. DSL error, not error template
+ expect(err).to include("There was an error parsing") # i.e. DSL error, not error template
end
end
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index efe6ccce7f..8e1205dfa3 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "with multiple toplevel sources" do
+ context "with multiple toplevel sources", :bundler => "< 3" do
let(:repo3_rack_version) { "1.0.0" }
before do
@@ -25,27 +25,24 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
gem "rack"
G
- bundle "config major_deprecations true"
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(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
end
- it "errors when disable_multisource is set" do
- bundle "config disable_multisource true"
+ it "fails", :bundler => "3" do
bundle :install
- expect(out).to include("Each source after the first must include a block")
+ expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
end
- context "when different versions of the same gem are in multiple sources" do
+ context "when different versions of the same gem are in multiple sources", :bundler => "< 3" do
let(:repo3_rack_version) { "1.2" }
before do
@@ -55,17 +52,20 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
gem "rack", "1.0.0" # force it to install the working version in repo1
G
- bundle "config major_deprecations true"
- end
- it "warns about ambiguous gems, but installs anyway", :bundler => "< 3" do
bundle :install
+ end
- expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
+ it "warns about ambiguous gems, but installs anyway", :bundler => "2" do
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}"))
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
end
+
+ it "fails", :bundler => "3" do
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
end
@@ -187,10 +187,9 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "when lockfile_uses_separate_rubygems_sources is set" do
+ context "when disable_multisource is set" do
before do
- bundle! "config lockfile_uses_separate_rubygems_sources true"
- bundle! "config disable_multisource true"
+ bundle! "config set disable_multisource true"
end
it "installs from the same source without any warning" do
@@ -237,7 +236,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
- context "and in yet another source" do
+ context "and in yet another source", :bundler => "< 3" do
before do
gemfile <<-G
source "file://localhost#{gem_repo1}"
@@ -246,19 +245,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "depends_on_rack"
end
G
- end
- it "installs from the other source and warns about ambiguous gems", :bundler => "< 3" do
- bundle "config major_deprecations true"
bundle :install
- expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.")
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}"))
+ end
+
+ it "installs from the other source and warns about ambiguous gems", :bundler => "2" do
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}"))
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
+
+ it "fails", :bundler => "3" do
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
- context "and only the dependency is pinned" do
+ context "and only the dependency is pinned", :bundler => "< 3" do
before do
# need this to be broken to check for correct source ordering
build_repo gem_repo2 do
@@ -276,10 +279,10 @@ 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(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")
# In https://github.com/bundler/bundler/issues/3585 this failed
@@ -287,18 +290,23 @@ RSpec.describe "bundle install with gems on multiple sources" do
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")
end
+
+ it "fails", :bundler => "3" do
+ bundle :install
+ expect(err).to include("Each source after the first must include a block")
+ expect(exitstatus).to eq(4) if exitstatus
+ end
end
end
end
context "when a top-level gem has an indirect dependency" do
- context "when lockfile_uses_separate_rubygems_sources is set" do
+ context "when disable_multisource is set" do
before do
- bundle! "config lockfile_uses_separate_rubygems_sources true"
- bundle! "config disable_multisource true"
+ bundle! "config set disable_multisource true"
end
before do
@@ -332,7 +340,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs all gems without warning" do
bundle :install
- expect(out).not_to include("Warning")
+ 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
@@ -348,7 +356,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not find the dependency" do
bundle :install
- expect(out).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources")
+ 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
@@ -367,7 +375,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs the dependency from the top-level source without warning" do
bundle :install
- expect(out).not_to include("Warning")
+ 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
@@ -388,7 +396,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not install the gem" do
bundle :install
- expect(out).to include("Could not find gem 'not_in_repo1'")
+ expect(err).to include("Could not find gem 'not_in_repo1'")
end
end
@@ -437,7 +445,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "does not unlock the non-path gem after install" do
bundle! :install
- bundle! %(exec ruby -e 'puts "OK"'), :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
+ bundle! %(exec ruby -e 'puts "OK"')
expect(out).to include("OK")
end
@@ -456,7 +464,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
it "installs the gems without any warning" do
bundle :install
- expect(out).not_to include("Warning")
+ expect(err).not_to include("Warning")
expect(the_bundle).to include_gems("rack 1.0.0")
end
end
@@ -544,7 +552,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "does not re-resolve" do
- bundle :install, :verbose => true
+ bundle! :install, :verbose => true
expect(out).to include("using resolution from the lockfile")
expect(out).not_to include("re-resolving dependencies")
end
@@ -616,4 +624,63 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
end
+
+ describe "source changed to one containing a higher version of a dependency" do
+ before do
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ G
+
+ build_repo2 do
+ build_gem "bar"
+ end
+
+ build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s|
+ s.add_dependency "bar", "=1.0.0"
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "rack"
+ gemspec :path => "#{tmp.join("gemspec_test")}"
+ G
+ end
+
+ 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", :bundler => "3" do
+ it "raises, suggesting a source block" do
+ build_repo4 do
+ build_gem "depends_on_rack" do |s|
+ s.add_dependency "rack"
+ end
+ build_gem "rack"
+ end
+
+ install_gemfile <<-G
+ source "file://localhost#{gem_repo4}"
+ source "file://localhost#{gem_repo1}" do
+ gem "thin"
+ end
+ gem "depends_on_rack"
+ G
+ expect(last_command).to be_failure
+ expect(err).to eq normalize_uri_file(strip_whitespace(<<-EOS).strip)
+ The gem 'rack' was found in multiple relevant sources.
+ * rubygems repository file://localhost#{gem_repo1}/ or installed locally
+ * rubygems repository file://localhost#{gem_repo4}/ or installed locally
+ You must add this gem to the source block for the source you wish it to be installed from.
+ EOS
+ expect(the_bundle).not_to be_locked
+ end
+ end
end
diff --git a/spec/bundler/install/gemfile/specific_platform_spec.rb b/spec/bundler/install/gemfile/specific_platform_spec.rb
index 9c725416d5..2c482b7ad4 100644
--- a/spec/bundler/install/gemfile/specific_platform_spec.rb
+++ b/spec/bundler/install/gemfile/specific_platform_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe "bundle install with specific_platform enabled" do
before do
- bundle "config specific_platform true"
+ bundle "config set specific_platform true"
build_repo2 do
build_gem("google-protobuf", "3.0.0.alpha.5.0.5.1")
diff --git a/spec/bundler/install/gemfile_spec.rb b/spec/bundler/install/gemfile_spec.rb
index e74c5ffe59..c26fbd74e7 100644
--- a/spec/bundler/install/gemfile_spec.rb
+++ b/spec/bundler/install/gemfile_spec.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
RSpec.describe "bundle install" do
@@ -8,7 +7,7 @@ RSpec.describe "bundle install" do
gem 'rails', '~> 4.0.0'
gem 'rails', '~> 4.0.0'
G
- expect(out).to include("more than once")
+ expect(err).to include("more than once")
end
end
@@ -35,7 +34,7 @@ RSpec.describe "bundle install" do
gem 'rack'
G
- bundle "config --local gemfile #{bundled_app("NotGemfile")}"
+ bundle "config set --local gemfile #{bundled_app("NotGemfile")}"
end
it "uses the gemfile to install" do
bundle "install"
@@ -65,23 +64,7 @@ RSpec.describe "bundle install" do
G
bundle :install
- expect(out).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
- end
- end
-
- context "with prefer_gems_rb set" do
- before { bundle! "config prefer_gems_rb true" }
-
- it "prefers gems.rb to Gemfile" do
- create_file("gems.rb", "gem 'bundler'")
- create_file("Gemfile", "raise 'wrong Gemfile!'")
-
- bundle! :install
-
- expect(bundled_app("gems.rb")).to be_file
- expect(bundled_app("Gemfile.lock")).not_to be_file
-
- expect(the_bundle).to include_gem "bundler #{Bundler::VERSION}"
+ expect(err).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
end
end
@@ -116,8 +99,6 @@ RSpec.describe "bundle install" do
context "with a Gemfile containing non-US-ASCII characters" do
it "reads the Gemfile with the UTF-8 encoding by default" do
- skip "Ruby 1.8 has no encodings" if RUBY_VERSION < "1.9"
-
install_gemfile <<-G
str = "Il était une fois ..."
puts "The source encoding is: " + str.encoding.name
@@ -129,8 +110,6 @@ RSpec.describe "bundle install" do
end
it "respects the magic encoding comment" do
- skip "Ruby 1.8 has no encodings" if RUBY_VERSION < "1.9"
-
# NOTE: This works thanks to #eval interpreting the magic encoding comment
install_gemfile <<-G
# encoding: iso-8859-1
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index 2acade1166..b94b68dbd9 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "compact index api" do
G
bundle :install, :artifice => "compact_index"
- expect(out).to include("' sinatra' is not a valid gem name because it contains whitespace.")
+ expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
it "should handle nested dependencies" do
@@ -226,7 +226,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install, :artifice => "compact_index_redirects"
- expect(out).to match(/Too many redirects/)
+ expect(err).to match(/Too many redirects/)
end
context "when --full-index is specified" do
@@ -247,7 +247,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
- bundle! "update --full-index", :artifice => "compact_index", :all => bundle_update_requires_all?
+ bundle! "update --full-index", :artifice => "compact_index", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -255,7 +255,7 @@ The checksum of /versions does not match the checksum provided by the server! So
it "does not double check for gems that are only installed locally" do
system_gems %w[rack-1.0.0 thin-1.0 net_a-1.0]
- bundle! "config --local path.system true"
+ bundle! "config set --local path.system true"
ENV["BUNDLER_SPEC_ALL_REQUESTS"] = strip_whitespace(<<-EOS).strip
#{source_uri}/versions
#{source_uri}/info/rack
@@ -628,8 +628,8 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle! :install, :artifice => "compact_index_basic_authentication"
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).not_to include("#{user}:#{password}")
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).not_to include("#{user}:#{password}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -652,7 +652,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "reads authentication details by host name from bundle config" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
@@ -662,7 +662,7 @@ The checksum of /versions does not match the checksum provided by the server! So
it "reads authentication details by full url from bundle config" do
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
- bundle "config #{source_uri}/ #{user}:#{password}"
+ bundle "config set #{source_uri}/ #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
@@ -671,7 +671,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "should use the API" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -683,7 +683,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
- bundle "config #{source_hostname} otheruser:wrong"
+ bundle "config set #{source_hostname} otheruser:wrong"
bundle! :install, :artifice => "compact_index_strict_basic_authentication"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -691,14 +691,14 @@ 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"
- expect(out).to include("bundle config #{source_hostname} username:password")
+ expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
- bundle "config #{source_hostname} #{user}:wrong"
+ bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "compact_index_strict_basic_authentication"
- expect(out).to include("Bad username or password")
+ expect(err).to include("Bad username or password")
end
end
@@ -737,7 +737,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
- expect(out).to include("OpenSSL")
+ expect(err).to include("OpenSSL")
end
end
@@ -757,7 +757,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install
- expect(out).to match(/could not verify the SSL certificate/i)
+ expect(err).to match(/could not verify the SSL certificate/i)
end
end
@@ -858,12 +858,12 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
expect(exitstatus).to eq(15) if exitstatus
- expect(out).to end_with(<<-E.strip)
+ expect(err).to end_with(<<-E.strip)
The request uri `htps://index.rubygems.org/versions` has an invalid scheme (`htps`). Did you mean `http` or `https`?
E
end
- describe "checksum validation", :rubygems => ">= 2.3.0" do
+ describe "checksum validation" do
it "raises when the checksum does not match" do
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
@@ -871,7 +871,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
expect(exitstatus).to eq(19) if exitstatus
- expect(out).
+ expect(err).
to include("Bundler cannot continue installing rack (1.0.0).").
and include("The checksum for the downloaded `rack-1.0.0.gem` does not match the checksum given by the server.").
and include("This means the contents of the downloaded gem is different from what was uploaded to the server, and could be a potential security issue.").
@@ -879,7 +879,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 disable_checksum_validation true` to turn off checksum verification").
+ and include("1. run `bundle config set 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
@@ -890,11 +890,11 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
expect(exitstatus).to eq(5) if exitstatus
- expect(out).to include("The given checksum for rack-1.0.0 (\"checksum!\") is not a valid SHA256 hexdigest nor base64digest")
+ expect(err).to include("The given checksum for rack-1.0.0 (\"checksum!\") is not a valid SHA256 hexdigest nor base64digest")
end
it "does not raise when disable_checksum_validation is set" do
- bundle! "config disable_checksum_validation true"
+ bundle! "config set disable_checksum_validation true"
install_gemfile! <<-G, :artifice => "compact_index_wrong_gem_checksum"
source "#{source_uri}"
gem "rack"
@@ -915,7 +915,7 @@ The checksum of /versions does not match the checksum provided by the server! So
source "#{source_uri}"
gem "rails"
G
- deps = [Gem::Dependency.new("rake", "= 10.0.2"),
+ deps = [Gem::Dependency.new("rake", "= 12.3.2"),
Gem::Dependency.new("actionpack", "= 2.3.2"),
Gem::Dependency.new("activerecord", "= 2.3.2"),
Gem::Dependency.new("actionmailer", "= 2.3.2"),
diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb
index 3cb98db1eb..0dc1ee87f2 100644
--- a/spec/bundler/install/gems/dependency_api_spec.rb
+++ b/spec/bundler/install/gems/dependency_api_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint"
- expect(out).to include("' sinatra' is not a valid gem name because it contains whitespace.")
+ expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
it "should handle nested dependencies" do
@@ -216,7 +216,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint_redirect"
- expect(out).to match(/Too many redirects/)
+ expect(err).to match(/Too many redirects/)
end
context "when --full-index is specified" do
@@ -237,7 +237,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle! "update --full-index", :artifice => "endpoint", :all => bundle_update_requires_all?
+ bundle! "update --full-index", :artifice => "endpoint", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -602,8 +602,8 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint_basic_authentication"
- expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
- expect(out).not_to include("#{user}:#{password}")
+ expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
+ expect(err).not_to include("#{user}:#{password}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -626,7 +626,7 @@ RSpec.describe "gemcutter's dependency API" do
end
it "reads authentication details by host name from bundle config" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
@@ -636,7 +636,7 @@ RSpec.describe "gemcutter's dependency API" do
it "reads authentication details by full url from bundle config" do
# The trailing slash is necessary here; Fetcher canonicalizes the URI.
- bundle "config #{source_uri}/ #{user}:#{password}"
+ bundle "config set #{source_uri}/ #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
@@ -645,7 +645,7 @@ RSpec.describe "gemcutter's dependency API" do
end
it "should use the API" do
- bundle "config #{source_hostname} #{user}:#{password}"
+ bundle "config set #{source_hostname} #{user}:#{password}"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -657,7 +657,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle "config #{source_hostname} otheruser:wrong"
+ bundle "config set #{source_hostname} otheruser:wrong"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -665,14 +665,14 @@ 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"
- expect(out).to include("bundle config #{source_hostname} username:password")
+ expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
- bundle "config #{source_hostname} #{user}:wrong"
+ bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
- expect(out).to include("Bad username or password")
+ expect(err).to include("Bad username or password")
end
end
@@ -711,7 +711,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :env => { "RUBYOPT" => "-I#{bundled_app("broken_ssl")}" }
- expect(out).to include("OpenSSL")
+ expect(err).to include("OpenSSL")
end
end
@@ -731,7 +731,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install
- expect(out).to match(/could not verify the SSL certificate/i)
+ expect(err).to match(/could not verify the SSL certificate/i)
end
end
diff --git a/spec/bundler/install/gems/flex_spec.rb b/spec/bundler/install/gems/flex_spec.rb
index 736f418ec7..aeb83d6573 100644
--- a/spec/bundler/install/gems/flex_spec.rb
+++ b/spec/bundler/install/gems/flex_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe "bundle flex_install" do
ruby <<-RUBY
require 'bundler/setup'
RUBY
- expect(err).to match(/could not find gem 'rack-obama/i)
+ expect(last_command.stderr).to match(/could not find gem 'rack-obama/i)
end
it "suggests bundle update when the Gemfile requires different versions than the lock" do
@@ -233,9 +233,9 @@ RSpec.describe "bundle flex_install" do
bundle "install"
end.not_to change { File.read(bundled_app("Gemfile.lock")) }
- expect(out).to include("rack = 0.9.1")
- expect(out).to include("locked at 1.0.0")
- expect(out).to include("bundle update rack")
+ expect(err).to include("rack = 0.9.1")
+ expect(err).to include("locked at 1.0.0")
+ expect(err).to include("bundle update rack")
end
it "should work when you update" do
@@ -264,7 +264,7 @@ RSpec.describe "bundle flex_install" do
rack (1.0.0)
PLATFORMS
- ruby
+ #{lockfile_platforms}
DEPENDENCIES
rack
@@ -345,7 +345,7 @@ RSpec.describe "bundle flex_install" do
gem "capybara", "0.3.9"
G
- expect(out).to include("Gemfile.lock")
+ expect(err).to include("Gemfile.lock")
end
end
end
diff --git a/spec/bundler/install/gems/mirror_spec.rb b/spec/bundler/install/gems/mirror_spec.rb
index 4c35b8f206..ffa6116127 100644
--- a/spec/bundler/install/gems/mirror_spec.rb
+++ b/spec/bundler/install/gems/mirror_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe "bundle install with a mirror configured" do
gem "rack"
G
- bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
+ bundle "config set --local mirror.http://gems.example.org http://gem-mirror.example.org"
end
it "installs from the normal location" do
@@ -26,7 +26,7 @@ RSpec.describe "bundle install with a mirror configured" do
gem "rack"
G
- bundle "config --local mirror.file://localhost#{gem_repo2} file://localhost#{gem_repo1}"
+ bundle "config set --local mirror.file://localhost#{gem_repo2} file://localhost#{gem_repo1}"
end
it "installs the gem from the mirror" do
diff --git a/spec/bundler/install/gems/native_extensions_spec.rb b/spec/bundler/install/gems/native_extensions_spec.rb
index ea616f60d3..9176a07084 100644
--- a/spec/bundler/install/gems/native_extensions_spec.rb
+++ b/spec/bundler/install/gems/native_extensions_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
gem "c_extension"
G
- bundle "config build.c_extension --with-c_extension=hello"
+ bundle "config set build.c_extension --with-c_extension=hello"
bundle "install"
expect(out).not_to include("extconf.rb failed")
@@ -76,7 +76,48 @@ RSpec.describe "installing a gem with native extensions", :ruby_repo do
C
end
- bundle! "config build.c_extension --with-c_extension=hello"
+ bundle! "config set build.c_extension --with-c_extension=hello"
+
+ install_gemfile! <<-G
+ gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
+ G
+
+ expect(out).not_to include("extconf.rb failed")
+
+ run! "Bundler.require; puts CExtension.new.its_true"
+ expect(out).to eq("true")
+ end
+
+ it "install with multiple build flags" do
+ build_git "c_extension" do |s|
+ s.extensions = ["ext/extconf.rb"]
+ s.write "ext/extconf.rb", <<-E
+ require "mkmf"
+ name = "c_extension_bundle"
+ dir_config(name)
+ raise "OMG" unless with_config("c_extension") == "hello" && with_config("c_extension_bundle-dir") == "hola"
+ create_makefile(name)
+ E
+
+ s.write "ext/c_extension.c", <<-C
+ #include "ruby.h"
+
+ VALUE c_extension_true(VALUE self) {
+ return Qtrue;
+ }
+
+ void Init_c_extension_bundle() {
+ VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
+ rb_define_method(c_Extension, "its_true", c_extension_true, 0);
+ }
+ C
+
+ s.write "lib/c_extension.rb", <<-C
+ require "c_extension_bundle"
+ C
+ end
+
+ bundle! "config set build.c_extension --with-c_extension=hello --with-c_extension_bundle-dir=hola"
install_gemfile! <<-G
gem "c_extension", :git => #{lib_path("c_extension-1.0").to_s.dump}
diff --git a/spec/bundler/install/gems/post_install_spec.rb b/spec/bundler/install/gems/post_install_spec.rb
index c6e348fb65..a6894fbc14 100644
--- a/spec/bundler/install/gems/post_install_spec.rb
+++ b/spec/bundler/install/gems/post_install_spec.rb
@@ -127,7 +127,7 @@ RSpec.describe "bundle install" do
gem "rack"
G
- bundle "config ignore_messages.rack true"
+ bundle "config set ignore_messages.rack true"
bundle :install
expect(out).not_to include("Post-install message")
@@ -141,7 +141,7 @@ RSpec.describe "bundle install" do
gem "rack"
G
- bundle "config ignore_messages true"
+ bundle "config set ignore_messages true"
bundle :install
expect(out).not_to include("Post-install message")
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index 01c03ac793..cf3aaa719e 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER" => "1" }
- expect(err).to include("Creating possibility state for net_c")
+ expect(last_command.stderr).to include("Creating possibility state for net_c")
end
end
@@ -91,7 +91,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" }
- expect(err).to include(" net_b").
+ expect(last_command.stderr).to include(" net_b").
and include("Starting resolution").
and include("Finished resolution").
and include("Attempting to activate")
@@ -117,6 +117,26 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
expect(the_bundle).to include_gems("rack 1.2")
end
+
+ it "installs the older version under rate limiting conditions" do
+ build_repo4 do
+ build_gem "rack", "9001.0.0" do |s|
+ s.required_ruby_version = "> 9000"
+ end
+ build_gem "rack", "1.2"
+ build_gem "foo1", "1.0"
+ end
+
+ install_gemfile <<-G, :artifice => "compact_index_rate_limited", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4 }
+ ruby "#{RUBY_VERSION}"
+ source "http://localgemserver.test/"
+ gem 'rack'
+ gem 'foo1'
+ G
+
+ expect(out).to_not include("rack-9001.0.0 requires ruby version > 9000")
+ expect(the_bundle).to include_gems("rack 1.2")
+ end
end
context "allows no gems" do
@@ -142,15 +162,14 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
nice_error = strip_whitespace(<<-E).strip
- Bundler could not find compatible versions for gem "ruby\0":
+ Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- ruby\0 (#{error_message_requirement})
+ Ruby\0 (#{error_message_requirement})
require_ruby was resolved to 1.0, which depends on
- ruby\0 (> 9000)
+ Ruby\0 (> 9000)
- Could not find gem 'ruby\0 (> 9000)', which is required by gem 'require_ruby', in any of the relevant sources:
- the local ruby installation
+ Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
E
expect(last_command.bundler_err).to end_with(nice_error)
end
@@ -188,8 +207,8 @@ RSpec.describe "bundle install with install-time dependencies" do
gem 'require_rubygems'
G
- expect(out).to_not include("Gem::InstallError: require_rubygems requires RubyGems version > 9000")
- expect(out).to include("require_rubygems-1.0 requires rubygems version > 9000, which is incompatible with the current version, #{Gem::VERSION}")
+ expect(err).to_not include("Gem::InstallError: require_rubygems requires RubyGems version > 9000")
+ expect(err).to include("require_rubygems-1.0 requires rubygems version > 9000, which is incompatible with the current version, #{Gem::VERSION}")
end
end
end
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index fa7a3bdc27..e2cfe5ec4c 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -75,7 +75,7 @@ RSpec.shared_examples "bundle install --standalone" do
G
end
- it "generates a bundle/bundler/setup.rb with the proper paths", :rubygems => "2.4" 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/'
@@ -108,8 +108,8 @@ RSpec.shared_examples "bundle install --standalone" do
end
it "outputs a helpful error message" do
- expect(out).to include("You have one or more invalid gemspecs that need to be fixed.")
- expect(out).to include("bar 1.0 has an invalid gemspec")
+ expect(err).to include("You have one or more invalid gemspecs that need to be fixed.")
+ expect(err).to include("bar 1.0 has an invalid gemspec")
end
end
diff --git a/spec/bundler/install/gems/sudo_spec.rb b/spec/bundler/install/gems/sudo_spec.rb
index 1781451c98..fb41f63a07 100644
--- a/spec/bundler/install/gems/sudo_spec.rb
+++ b/spec/bundler/install/gems/sudo_spec.rb
@@ -4,7 +4,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and BUNDLE_PATH is writable" do
context "but BUNDLE_PATH/build_info is not writable" do
before do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
subdir = system_gem_path("cache")
subdir.mkpath
sudo "chmod u-w #{subdir}"
@@ -25,7 +25,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and GEM_HOME is owned by root" do
before :each do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
chown_system_gems_to_root
end
@@ -52,7 +52,7 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "installs when BUNDLE_PATH is owned by root" do
- bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
+ bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
bundle_path = tmp("owned_by_root")
FileUtils.mkdir_p bundle_path
@@ -70,7 +70,7 @@ RSpec.describe "when using sudo", :sudo => true do
end
it "installs when BUNDLE_PATH does not exist" do
- bundle! "config global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
+ bundle! "config set global_path_appends_ruby_scope false" # consistency in tests between 1.x and 2.x modes
root_path = tmp("owned_by_root")
FileUtils.mkdir_p root_path
@@ -88,7 +88,7 @@ RSpec.describe "when using sudo", :sudo => true do
expect(the_bundle).to include_gems "rack 1.0"
end
- it "installs extensions/ compiled by RubyGems 2.2", :rubygems => "2.2" do
+ it "installs extensions/" do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "very_simple_binary"
@@ -133,7 +133,7 @@ RSpec.describe "when using sudo", :sudo => true do
describe "and GEM_HOME is not writable" do
it "installs" do
- bundle! "config path.system true"
+ bundle! "config set path.system true"
gem_home = tmp("sudo_gem_home")
sudo "mkdir -p #{gem_home}"
sudo "chmod ugo-w #{gem_home}"
@@ -158,20 +158,20 @@ RSpec.describe "when using sudo", :sudo => true do
it "warns against that" do
bundle :install, :sudo => true
- expect(out).to include(warning)
+ expect(err).to include(warning)
end
context "when ENV['BUNDLE_SILENCE_ROOT_WARNING'] is set" do
it "skips the warning" do
bundle :install, :sudo => :preserve_env, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => true }
- expect(out).to_not include(warning)
+ expect(err).to_not include(warning)
end
end
context "when silence_root_warning = false" do
it "warns against that" do
bundle :install, :sudo => true, :env => { "BUNDLE_SILENCE_ROOT_WARNING" => "false" }
- expect(out).to include(warning)
+ expect(err).to include(warning)
end
end
end
diff --git a/spec/bundler/install/gemspecs_spec.rb b/spec/bundler/install/gemspecs_spec.rb
index 666707b295..c9878ccae8 100644
--- a/spec/bundler/install/gemspecs_spec.rb
+++ b/spec/bundler/install/gemspecs_spec.rb
@@ -1,4 +1,3 @@
-# encoding: utf-8
# frozen_string_literal: true
RSpec.describe "bundle install" do
@@ -15,7 +14,7 @@ RSpec.describe "bundle install" do
gem "yaml_spec"
G
bundle :install
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
it "still installs correctly when using path" do
@@ -24,7 +23,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
- expect(err).to lack_errors
+ expect(last_command.stderr).to be_empty
end
end
@@ -48,11 +47,11 @@ RSpec.describe "bundle install" do
end
it "does not hang when gemspec has incompatible encoding" do
- create_file "foo.gemspec", <<-G
+ create_file("foo.gemspec", <<-G)
Gem::Specification.new do |gem|
gem.name = "pry-byebug"
gem.version = "3.4.2"
- gem.author = "David Rodriguez"
+ gem.author = "David Rodríguez"
gem.summary = "Good stuff"
end
G
@@ -65,8 +64,6 @@ RSpec.describe "bundle install" do
end
it "reads gemspecs respecting their encoding" do
- skip "Unicode is not supported on Ruby 1.x without extra work" if RUBY_VERSION < "2.0"
-
create_file "version.rb", <<-RUBY
module Persistent💎
VERSION = "0.0.1"
@@ -129,8 +126,8 @@ RSpec.describe "bundle install" do
gemspec
G
- expect(out).to include("Ruby patchlevel")
- expect(out).to include("but your Gemfile specified")
+ expect(err).to include("Ruby patchlevel")
+ expect(err).to include("but your Gemfile specified")
expect(exitstatus).to eq(18) if exitstatus
end
@@ -146,8 +143,8 @@ RSpec.describe "bundle install" do
gemspec
G
- expect(out).to include("Ruby version")
- expect(out).to include("but your Gemfile specified")
+ expect(err).to include("Ruby version")
+ expect(err).to include("but your Gemfile specified")
expect(exitstatus).to eq(18) if exitstatus
end
end
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index 48086a86c7..68b2f47c10 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at master~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb
index e41e7e0157..345ad86db8 100644
--- a/spec/bundler/install/global_cache_spec.rb
+++ b/spec/bundler/install/global_cache_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
RSpec.describe "global gem caching" do
- before { bundle! "config global_gem_cache true" }
+ before { bundle! "config set global_gem_cache true" }
describe "using the cross-application user cache" do
let(:source) { "http://localgemserver.test" }
@@ -112,7 +112,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
- expect(out).to include("Internal Server Error 500")
+ expect(err).to include("Internal Server Error 500")
# rack 1.0.0 is not installed and rack 0.9.1 is not
expect(the_bundle).not_to include_gems "rack 1.0.0"
expect(the_bundle).not_to include_gems "rack 0.9.1"
@@ -125,7 +125,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
- expect(out).to include("Internal Server Error 500")
+ expect(err).to include("Internal Server Error 500")
# rack 0.9.1 is not installed and rack 1.0.0 is not
expect(the_bundle).not_to include_gems "rack 0.9.1"
expect(the_bundle).not_to include_gems "rack 1.0.0"
@@ -187,7 +187,7 @@ RSpec.describe "global gem caching" do
end
end
- describe "extension caching", :ruby_repo, :rubygems => "2.2" do
+ describe "extension caching", :ruby_repo do
it "works" do
build_git "very_simple_git_binary", &:add_c_extension
build_lib "very_simple_path_binary", &:add_c_extension
@@ -220,7 +220,7 @@ RSpec.describe "global gem caching" do
gem_binary_cache.join("very_simple_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" }
git_binary_cache.join("very_simple_git_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" }
- bundle! "config --local path different_path"
+ bundle! "config set --local path different_path"
bundle! :install
expect(Dir[home(".bundle", "cache", "extensions", "**", "*binary_c*")]).to all(end_with(".rb"))
diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb
index 94f38c9290..0947ed9539 100644
--- a/spec/bundler/install/path_spec.rb
+++ b/spec/bundler/install/path_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe "bundle install" do
it "disallows --path vendor/bundle --system", :bundler => "< 3" do
bundle "install --path vendor/bundle --system"
- expect(out).to include("Please choose only one option.")
+ expect(err).to include("Please choose only one option.")
expect(exitstatus).to eq(15) if exitstatus
end
@@ -51,7 +51,7 @@ RSpec.describe "bundle install" do
end
context "with path_relative_to_cwd set to true" do
- before { bundle! "config path_relative_to_cwd true" }
+ before { bundle! "config set path_relative_to_cwd true" }
it "installs the bundle relatively to current working directory", :bundler => "< 3" do
Dir.chdir(bundled_app.parent) do
@@ -98,7 +98,7 @@ RSpec.describe "bundle install" do
if type == :env
ENV["BUNDLE_PATH"] = location
elsif type == :global
- bundle! "config path #{location}", "no-color" => nil
+ bundle! "config set path #{location}", "no-color" => nil
end
end
@@ -116,7 +116,7 @@ RSpec.describe "bundle install" do
context "with global_path_appends_ruby_scope set", :bundler => "3" do
it "installs gems to ." do
set_bundle_path(type, ".")
- bundle! "config --global disable_shared_gems true"
+ bundle! "config set --global disable_shared_gems true"
bundle! :install
@@ -150,7 +150,7 @@ RSpec.describe "bundle install" do
context "with global_path_appends_ruby_scope unset", :bundler => "< 3" do
it "installs gems to ." do
set_bundle_path(type, ".")
- bundle! "config --global disable_shared_gems true"
+ bundle! "config set --global disable_shared_gems true"
bundle! :install
@@ -207,7 +207,7 @@ RSpec.describe "bundle install" do
expect(the_bundle).to include_gems "rack 1.0.0"
end
- it "re-installs gems whose extensions have been deleted", :ruby_repo, :rubygems => ">= 2.3" do
+ it "re-installs gems whose extensions have been deleted", :ruby_repo do
build_lib "very_simple_binary", "1.0.0", :to_system => true do |s|
s.write "lib/very_simple_binary.rb", "raise 'FAIL'"
end
@@ -226,7 +226,7 @@ RSpec.describe "bundle install" do
vendored_gems("extensions").rmtree
run "require 'very_simple_binary_c'"
- expect(err).to include("Bundler::GemNotFound")
+ expect(last_command.stderr).to include("Bundler::GemNotFound")
bundle :install, forgotten_command_line_options(:path => "./vendor/bundle")
@@ -250,7 +250,7 @@ RSpec.describe "bundle install" do
G
bundle :install, forgotten_command_line_options(:path => "bundle")
- expect(out).to include("file already exists")
+ expect(err).to include("file already exists")
end
end
end
diff --git a/spec/bundler/install/post_bundle_message_spec.rb b/spec/bundler/install/post_bundle_message_spec.rb
index 394134f523..1efd0b8146 100644
--- a/spec/bundler/install/post_bundle_message_spec.rb
+++ b/spec/bundler/install/post_bundle_message_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe "post bundle message" do
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.")
+ 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
@@ -116,7 +116,7 @@ RSpec.describe "post bundle message" do
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include normalize_uri_file(<<-EOS.strip)
+ expect(err).to include normalize_uri_file(<<-EOS.strip)
Could not find gem 'not-a-gem' in rubygems repository file://localhost#{gem_repo1}/ or installed locally.
The source does not contain any versions of 'not-a-gem'
EOS
@@ -134,7 +134,7 @@ The source does not contain any versions of 'not-a-gem'
gem "rack"
gem "not-a-gem", :group => :development
G
- expect(out).to include("Could not find gem 'not-a-gem' in").
+ expect(err).to include("Could not find gem 'not-a-gem' in").
and include("or in gems cached in vendor/cache.")
end
end
@@ -177,28 +177,28 @@ The source does not contain any versions of 'not-a-gem'
describe "for bundle update" do
it "without any options" do
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message)
end
it "with --without one group" do
bundle! :install, forgotten_command_line_options(:without => "emo")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_updated_message)
end
it "with --without two groups" do
bundle! :install, forgotten_command_line_options(:without => "emo test")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_updated_message)
end
it "with --without more groups" do
bundle! :install, forgotten_command_line_options(:without => "emo obama test")
- bundle! :update, :all => bundle_update_requires_all?
+ bundle! :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not installed")
expect(out).to include(bundle_updated_message)
end
diff --git a/spec/bundler/install/process_lock_spec.rb b/spec/bundler/install/process_lock_spec.rb
index be8fd04fdd..df1e9c6350 100644
--- a/spec/bundler/install/process_lock_spec.rb
+++ b/spec/bundler/install/process_lock_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe "process lock spec" do
expect(the_bundle).to include_gems "rack 1.0"
end
- context "when creating a lock raises Errno::ENOTSUP", :ruby => ">= 1.9" do
+ context "when creating a lock raises Errno::ENOTSUP" do
before { allow(File).to receive(:open).and_raise(Errno::ENOTSUP) }
it "skips creating the lock file and yields" do
diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb
index f9caeed58a..2a0cdc9473 100644
--- a/spec/bundler/install/redownload_spec.rb
+++ b/spec/bundler/install/redownload_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
+RSpec.describe "bundle install" do
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -8,8 +8,6 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
G
end
- before { bundle "config major_deprecations yes" }
-
shared_examples_for "an option to force redownloading gems" do
it "re-installs installed gems" do
rack_lib = default_bundle_path("gems/rack-1.0.0/lib/rack.rb")
@@ -58,19 +56,19 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
end
end
- describe "with --force" do
+ describe "with --force", :bundler => 2 do
it_behaves_like "an option to force redownloading gems" do
let(:flag) { "force" }
end
it "shows a deprecation when single flag passed" do
bundle! "install --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
it "shows a deprecation when multiple flags passed" do
bundle! "install --no-color --force"
- expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
@@ -81,12 +79,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do
it "does not show a deprecation when single flag passed" do
bundle! "install --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
it "does not show a deprecation when single multiple flags passed" do
bundle! "install --no-color --redownload"
- expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`"
+ expect(err).not_to include "[DEPRECATED] The `--force` option has been renamed to `--redownload`"
end
end
end
diff --git a/spec/bundler/install/security_policy_spec.rb b/spec/bundler/install/security_policy_spec.rb
index 7be09d6bd4..ad76162aac 100644
--- a/spec/bundler/install/security_policy_spec.rb
+++ b/spec/bundler/install/security_policy_spec.rb
@@ -24,18 +24,17 @@ RSpec.describe "policies with unsigned gems" do
it "will fail when given invalid security policy" do
bundle "install --trust-policy=InvalidPolicyName"
- expect(out).to include("RubyGems doesn't know about trust policy")
+ expect(err).to include("RubyGems doesn't know about trust policy")
end
it "will fail with High Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=HighSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
- # This spec will fail on RubyGems 2 rc1 due to a bug in policy.rb. the bug is fixed in rc3.
- it "will fail with Medium Security setting due to presence of unsigned gem", :unless => ENV["RGV"] == "v2.0.0.rc.1" do
+ it "will fail with Medium Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=MediumSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will succeed with no policy" do
@@ -55,12 +54,12 @@ RSpec.describe "policies with signed gems and no CA" do
it "will fail with High Security setting, gem is self-signed" do
bundle "install --trust-policy=HighSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will fail with Medium Security setting, gem is self-signed" do
bundle "install --trust-policy=MediumSecurity"
- expect(out).to include("security policy didn't allow")
+ expect(err).to include("security policy didn't allow")
end
it "will succeed with Low Security setting, low security accepts self signed gem" do
diff --git a/spec/bundler/install/yanked_spec.rb b/spec/bundler/install/yanked_spec.rb
index 7c4b98bfdf..3e6f6a3bcd 100644
--- a/spec/bundler/install/yanked_spec.rb
+++ b/spec/bundler/install/yanked_spec.rb
@@ -27,7 +27,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do
gem "foo", "10.0.0"
G
- expect(out).to include("Your bundle is locked to foo (10.0.0)")
+ expect(err).to include("Your bundle is locked to foo (10.0.0)")
end
it "throws the original error when only the Gemfile specifies a gem version that doesn't exist" do
@@ -36,8 +36,8 @@ RSpec.context "when installing a bundle that includes yanked gems" do
gem "foo", "10.0.0"
G
- expect(out).not_to include("Your bundle is locked to foo (10.0.0)")
- expect(out).to include("Could not find gem 'foo (= 10.0.0)' in")
+ expect(err).not_to include("Your bundle is locked to foo (10.0.0)")
+ expect(err).to include("Could not find gem 'foo (= 10.0.0)' in")
end
end
@@ -63,9 +63,9 @@ RSpec.context "when using gem before installing" do
bundle :list
- expect(out).to include("Could not find rack-0.9.1 in any of the sources")
- expect(out).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
- expect(out).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
- expect(out).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
+ expect(err).to include("Could not find rack-0.9.1 in any of the sources")
+ expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
+ expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
+ expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
end
end