summaryrefslogtreecommitdiff
path: root/spec/bundler
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 10:11:34 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 13:14:43 +0900
commit69ed64949b0c02d4b195809fa104ff23dd100093 (patch)
treec07abfd061a2da7610e252960c06a64e8b17e6c3 /spec/bundler
parent5537adf719a37a30b17d39111cc03700f353aa2d (diff)
Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4021
Diffstat (limited to 'spec/bundler')
-rw-r--r--spec/bundler/bundler/definition_spec.rb10
-rw-r--r--spec/bundler/bundler/env_spec.rb1
-rw-r--r--spec/bundler/bundler/gem_helper_spec.rb10
-rw-r--r--spec/bundler/bundler/plugin_spec.rb20
-rw-r--r--spec/bundler/bundler/shared_helpers_spec.rb24
-rw-r--r--spec/bundler/bundler/source/git/git_proxy_spec.rb16
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb19
-rw-r--r--spec/bundler/commands/cache_spec.rb10
-rw-r--r--spec/bundler/commands/check_spec.rb4
-rw-r--r--spec/bundler/commands/config_spec.rb4
-rw-r--r--spec/bundler/commands/exec_spec.rb12
-rw-r--r--spec/bundler/commands/help_spec.rb16
-rw-r--r--spec/bundler/commands/install_spec.rb35
-rw-r--r--spec/bundler/commands/newgem_spec.rb10
-rw-r--r--spec/bundler/commands/post_bundle_message_spec.rb30
-rw-r--r--spec/bundler/install/deploy_spec.rb38
-rw-r--r--spec/bundler/install/gemfile/eval_gemfile_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/gemspec_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb6
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb40
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/platform_spec.rb2
-rw-r--r--spec/bundler/install/gemfile/sources_spec.rb4
-rw-r--r--spec/bundler/install/gems/compact_index_spec.rb10
-rw-r--r--spec/bundler/install/gems/dependency_api_spec.rb10
-rw-r--r--spec/bundler/install/gems/standalone_spec.rb26
-rw-r--r--spec/bundler/install/git_spec.rb4
-rw-r--r--spec/bundler/install/path_spec.rb22
-rw-r--r--spec/bundler/lock/lockfile_spec.rb2
-rw-r--r--spec/bundler/plugins/install_spec.rb2
-rw-r--r--spec/bundler/plugins/source/example_spec.rb4
-rw-r--r--spec/bundler/quality_spec.rb2
-rw-r--r--spec/bundler/runtime/setup_spec.rb91
-rw-r--r--spec/bundler/spec_helper.rb1
-rw-r--r--spec/bundler/support/path.rb6
-rw-r--r--spec/bundler/support/rubygems_ext.rb20
-rw-r--r--spec/bundler/support/streams.rb19
37 files changed, 293 insertions, 245 deletions
diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb
index dcdde75315..5f8b88a101 100644
--- a/spec/bundler/bundler/definition_spec.rb
+++ b/spec/bundler/bundler/definition_spec.rb
@@ -31,6 +31,16 @@ RSpec.describe Bundler::Definition do
to raise_error(Bundler::TemporaryResourceError, /temporarily unavailable/)
end
end
+ context "when Bundler::Definition.no_lock is set to true" do
+ subject { Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
+ before { Bundler::Definition.no_lock = true }
+ after { Bundler::Definition.no_lock = false }
+
+ it "does not create a lock file" do
+ subject.lock("Gemfile.lock")
+ expect(File.file?("Gemfile.lock")).to eq false
+ end
+ end
end
describe "detects changes" do
diff --git a/spec/bundler/bundler/env_spec.rb b/spec/bundler/bundler/env_spec.rb
index ac65c34b0d..2cdead6eac 100644
--- a/spec/bundler/bundler/env_spec.rb
+++ b/spec/bundler/bundler/env_spec.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require "bundler/settings"
+require "openssl"
RSpec.describe Bundler::Env do
let(:git_proxy_stub) { Bundler::Source::Git::GitProxy.new(nil, nil, nil) }
diff --git a/spec/bundler/bundler/gem_helper_spec.rb b/spec/bundler/bundler/gem_helper_spec.rb
index 48af7867b4..30befdf40c 100644
--- a/spec/bundler/bundler/gem_helper_spec.rb
+++ b/spec/bundler/bundler/gem_helper_spec.rb
@@ -256,6 +256,16 @@ RSpec.describe Bundler::GemHelper do
Rake.application["release"].invoke
end
+
+ it "also works when releasing from an ambiguous reference" do
+ # Create a branch with the same name as the tag
+ sys_exec("git checkout -b v#{app_version}", :dir => app_path)
+ sys_exec("git push -u origin v#{app_version}", :dir => app_path)
+
+ expect(subject).to receive(:rubygem_push).with(app_gem_path.to_s)
+
+ Rake.application["release"].invoke
+ end
end
context "on releasing with a custom tag prefix" do
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb
index 8c95723bcc..c1c88ce480 100644
--- a/spec/bundler/bundler/plugin_spec.rb
+++ b/spec/bundler/bundler/plugin_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../support/streams"
-
RSpec.describe Bundler::Plugin do
Plugin = Bundler::Plugin
@@ -296,11 +294,9 @@ RSpec.describe Bundler::Plugin do
end
it "executes the hook" do
- out = capture(:stdout) do
+ expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1)
- end.strip
-
- expect(out).to eq("hook for event 1")
+ end.to output("hook for event 1\n").to_stdout
end
context "single plugin declaring more than one hook" do
@@ -311,12 +307,10 @@ RSpec.describe Bundler::Plugin do
RUBY
it "evals plugins.rb once" do
- out = capture(:stdout) do
+ expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1)
Plugin.hook(Bundler::Plugin::Events::EVENT_2)
- end.strip
-
- expect(out).to eq("loaded")
+ end.to output("loaded\n").to_stdout
end
end
@@ -326,11 +320,9 @@ RSpec.describe Bundler::Plugin do
RUBY
it "is passed to the hook" do
- out = capture(:stdout) do
+ expect do
Plugin.hook(Bundler::Plugin::Events::EVENT_1) { puts "win" }
- end.strip
-
- expect(out).to eq("win")
+ end.to output("win\n").to_stdout
end
end
end
diff --git a/spec/bundler/bundler/shared_helpers_spec.rb b/spec/bundler/bundler/shared_helpers_spec.rb
index 97647dc6eb..68a24be31c 100644
--- a/spec/bundler/bundler/shared_helpers_spec.rb
+++ b/spec/bundler/bundler/shared_helpers_spec.rb
@@ -494,28 +494,4 @@ RSpec.describe Bundler::SharedHelpers do
end
end
end
-
- describe "#const_get_safely" do
- module TargetNamespace
- VALID_CONSTANT = 1
- end
-
- context "when the namespace does have the requested constant" do
- it "returns the value of the requested constant" do
- expect(subject.const_get_safely(:VALID_CONSTANT, TargetNamespace)).to eq(1)
- end
- end
-
- context "when the requested constant is passed as a string" do
- it "returns the value of the requested constant" do
- expect(subject.const_get_safely("VALID_CONSTANT", TargetNamespace)).to eq(1)
- end
- end
-
- context "when the namespace does not have the requested constant" do
- it "returns nil" do
- expect(subject.const_get_safely("INVALID_CONSTANT", TargetNamespace)).to be_nil
- end
- end
- end
end
diff --git a/spec/bundler/bundler/source/git/git_proxy_spec.rb b/spec/bundler/bundler/source/git/git_proxy_spec.rb
index 4744e0cd4c..35702d7763 100644
--- a/spec/bundler/bundler/source/git/git_proxy_spec.rb
+++ b/spec/bundler/bundler/source/git/git_proxy_spec.rb
@@ -11,21 +11,21 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "with configured credentials" do
it "adds username and password to URI" do
Bundler.settings.temporary(uri => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
+ expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout
end
end
it "adds username and password to URI for host" do
Bundler.settings.temporary("github.com" => "u:p") do
- expect(subject).to receive(:git_retry).with(match("https://u:p@github.com/rubygems/rubygems.git"))
+ expect(subject).to receive(:git_retry).with("clone", "https://u:p@github.com/rubygems/rubygems.git", any_args)
subject.checkout
end
end
it "does not add username and password to mismatched URI" do
Bundler.settings.temporary("https://u:p@github.com/rubygems/rubygems-mismatch.git" => "u:p") do
- expect(subject).to receive(:git_retry).with(match(uri))
+ expect(subject).to receive(:git_retry).with("clone", uri, any_args)
subject.checkout
end
end
@@ -34,7 +34,7 @@ RSpec.describe Bundler::Source::Git::GitProxy do
Bundler.settings.temporary("github.com" => "u:p") do
original = "https://orig:info@github.com/rubygems/rubygems.git"
subject = described_class.new(Pathname("path"), original, "HEAD")
- expect(subject).to receive(:git_retry).with(match(original))
+ expect(subject).to receive(:git_retry).with("clone", original, any_args)
subject.checkout
end
end
@@ -129,12 +129,12 @@ RSpec.describe Bundler::Source::Git::GitProxy do
context "when given a SHA as a revision" do
let(:revision) { "abcd" * 10 }
- let(:command) { "reset --hard #{revision}" }
+ let(:command) { ["reset", "--hard", revision] }
it "fails gracefully when resetting to the revision fails" do
- expect(subject).to receive(:git_retry).with(start_with("clone ")) { destination.mkpath }
- expect(subject).to receive(:git_retry).with(start_with("fetch "), :dir => destination)
- expect(subject).to receive(:git).with(command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
+ expect(subject).to receive(:git_retry).with("clone", any_args) { destination.mkpath }
+ expect(subject).to receive(:git_retry).with("fetch", any_args, :dir => destination)
+ expect(subject).to receive(:git).with(*command, :dir => destination).and_raise(Bundler::Source::Git::GitCommandError.new(command, cache, destination))
expect(subject).not_to receive(:git)
expect { subject.copy_to(destination, submodules) }.
diff --git a/spec/bundler/bundler/ui/shell_spec.rb b/spec/bundler/bundler/ui/shell_spec.rb
index 536014c6aa..15120a8a41 100644
--- a/spec/bundler/bundler/ui/shell_spec.rb
+++ b/spec/bundler/bundler/ui/shell_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../../support/streams"
-
RSpec.describe Bundler::UI::Shell do
subject { described_class.new }
@@ -43,10 +41,19 @@ RSpec.describe Bundler::UI::Shell do
context "when stderr is closed" do
it "doesn't report anything" do
- output = capture(:stderr, :closed => true) do
- subject.error("Something went wrong")
- end
- expect(output).to_not eq("Something went wrong\n")
+ output = begin
+ result = StringIO.new
+ result.close
+
+ $stderr = result
+
+ subject.error("Something went wrong")
+
+ result.string
+ ensure
+ $stderr = STDERR
+ end
+ expect(output).to_not eq("Something went wrong")
end
end
end
diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb
index 173389c068..f4a57039ad 100644
--- a/spec/bundler/commands/cache_spec.rb
+++ b/spec/bundler/commands/cache_spec.rb
@@ -221,7 +221,7 @@ RSpec.describe "bundle cache" do
end
end
- bundle "config --local without wo"
+ bundle "config set --local without wo"
install_gemfile <<-G
source "file:#{gem_repo1}"
gem "rack"
@@ -237,7 +237,7 @@ RSpec.describe "bundle cache" do
expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
- bundle "config --local without wo"
+ bundle "config set --local without wo"
bundle :install
expect(the_bundle).to include_gem "rack 1.0"
expect(the_bundle).not_to include_gems "weakling", "uninstallable"
@@ -254,7 +254,7 @@ RSpec.describe "bundle cache" do
end
subject do
- bundle "config --local frozen true"
+ bundle "config set --local frozen true"
bundle :cache, :raise_on_error => false
end
@@ -304,8 +304,8 @@ RSpec.describe "bundle install with gem sources" do
simulate_new_machine
FileUtils.rm_rf gem_repo2
- bundle "config --local deployment true"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local deployment true"
+ bundle "config set --local path vendor/bundle"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0"
end
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index fdf3bc7d51..2fb03186be 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -124,7 +124,7 @@ RSpec.describe "bundle check" do
gem "rack", :group => :foo
G
- bundle "config --local without foo"
+ bundle "config set --local without foo"
bundle :install
gemfile <<-G
@@ -217,7 +217,7 @@ RSpec.describe "bundle check" do
gem "foo"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle "install"
FileUtils.rm(bundled_app_lock)
diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb
index 70e3feff00..a7c0813210 100644
--- a/spec/bundler/commands/config_spec.rb
+++ b/spec/bundler/commands/config_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe ".bundle/config" do
it "can be moved with an environment variable" do
ENV["BUNDLE_APP_CONFIG"] = tmp("foo/bar").to_s
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install"
expect(bundled_app(".bundle")).not_to exist
@@ -57,7 +57,7 @@ RSpec.describe ".bundle/config" do
FileUtils.mkdir_p bundled_app("omg")
ENV["BUNDLE_APP_CONFIG"] = "../foo"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install", :dir => bundled_app("omg")
expect(bundled_app(".bundle")).not_to exist
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 1449bb642e..6485eb6a5a 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -295,7 +295,7 @@ RSpec.describe "bundle exec" do
end
it "handles gems installed with --without" do
- bundle "config --local without middleware"
+ bundle "config set --local without middleware"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack" # rack 0.9.1 and 1.0 exist
@@ -448,35 +448,35 @@ RSpec.describe "bundle exec" do
with_fake_man do
bundle "#{exec} --help cat"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is before exec" do
with_fake_man do
bundle "--help #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is before exec" do
with_fake_man do
bundle "-h #{exec}"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when --help is after exec" do
with_fake_man do
bundle "#{exec} --help"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
it "shows bundle-exec's man page when -h is after exec" do
with_fake_man do
bundle "#{exec} -h"
end
- expect(out).to include(%(["#{root}/man/bundle-exec.1"]))
+ expect(out).to include(%(["#{man_dir}/bundle-exec.1"]))
end
end
end
diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb
index 03d34ef692..f72763900e 100644
--- a/spec/bundler/commands/help_spec.rb
+++ b/spec/bundler/commands/help_spec.rb
@@ -5,14 +5,14 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "help gemfile"
end
- expect(out).to eq(%(["#{root}/man/gemfile.5"]))
+ expect(out).to eq(%(["#{man_dir}/gemfile.5"]))
end
it "prefixes bundle commands with bundle- when finding the man files" do
with_fake_man do
bundle "help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "simply outputs the human readable file when there is no man on the path" do
@@ -45,28 +45,28 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "install --help"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the --help flag is used before the command" do
with_fake_man do
bundle "--help install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used before the command" do
with_fake_man do
bundle "-h install"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "is called when the -h flag is used after the command" do
with_fake_man do
bundle "install -h"
end
- expect(out).to eq(%(["#{root}/man/bundle-install.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle-install.1"]))
end
it "has helpful output when using --help flag for a non-existent command" do
@@ -80,11 +80,11 @@ RSpec.describe "bundle help" do
with_fake_man do
bundle "--help"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
with_fake_man do
bundle "-h"
end
- expect(out).to eq(%(["#{root}/man/bundle.1"]))
+ expect(out).to eq(%(["#{man_dir}/bundle.1"]))
end
end
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 043805df79..c91864dbb8 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -291,7 +291,7 @@ RSpec.describe "bundle install with gem sources" do
end
it "works" do
- bundle "config --local path vendor"
+ bundle "config set --local path vendor"
bundle "install"
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -580,8 +580,31 @@ RSpec.describe "bundle install with gem sources" do
end
describe "when bundle path does not have write access", :permissions do
+ let(:bundle_path) { bundled_app("vendor") }
+
+ before do
+ FileUtils.mkdir_p(bundle_path)
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo1)}"
+ gem 'rack'
+ G
+ end
+
+ it "should display a proper message to explain the problem" do
+ FileUtils.chmod(0o500, bundle_path)
+
+ bundle "config set --local path vendor"
+ bundle :install, :raise_on_error => false
+ expect(err).to include(bundle_path.to_s)
+ expect(err).to include("grant write permissions")
+ end
+ end
+
+ describe "when bundle cache path does not have write access", :permissions do
+ let(:cache_path) { bundled_app("vendor/#{Bundler.ruby_scope}/cache") }
+
before do
- FileUtils.mkdir_p(bundled_app("vendor"))
+ FileUtils.mkdir_p(cache_path)
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem 'rack'
@@ -589,11 +612,11 @@ RSpec.describe "bundle install with gem sources" do
end
it "should display a proper message to explain the problem" do
- FileUtils.chmod(0o500, bundled_app("vendor"))
+ FileUtils.chmod(0o500, cache_path)
- bundle "config --local path vendor"
+ bundle "config set --local path vendor"
bundle :install, :raise_on_error => false
- expect(err).to include(bundled_app("vendor").to_s)
+ expect(err).to include(cache_path.to_s)
expect(err).to include("grant write permissions")
end
end
@@ -604,7 +627,7 @@ RSpec.describe "bundle install with gem sources" do
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
- bundle "config --local path bundle"
+ bundle "config set --local path bundle"
bundle "install", :standalone => true
end
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 421ffa80c6..8aca745bef 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -536,7 +536,7 @@ RSpec.describe "bundle gem" do
end
it "builds spec skeleton" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
end
@@ -556,7 +556,7 @@ RSpec.describe "bundle gem" do
end
it "builds spec skeleton" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb")).to exist
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to exist
end
@@ -565,11 +565,11 @@ RSpec.describe "bundle gem" do
end
it "requires 'test_helper'" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include(%(require "test_helper"))
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include(%(require "test_helper"))
end
it "creates a default test which fails" do
- expect(bundled_app("#{gem_name}/test/#{require_path}_test.rb").read).to include("assert false")
+ expect(bundled_app("#{gem_name}/test/test_#{require_path}.rb").read).to include("assert false")
end
end
@@ -589,7 +589,7 @@ RSpec.describe "bundle gem" do
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
- t.test_files = FileList["test/**/*_test.rb"]
+ t.test_files = FileList["test/**/test_*.rb"]
end
task default: :test
diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb
index 2c965f0ddd..710152e59f 100644
--- a/spec/bundler/commands/post_bundle_message_spec.rb
+++ b/spec/bundler/commands/post_bundle_message_spec.rb
@@ -29,21 +29,21 @@ RSpec.describe "post bundle message" do
expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats)
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message)
expect(out).to include(installed_gems_stats)
- bundle "config --local without emo test"
+ bundle "config set --local without emo test"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message)
expect(out).to include("4 Gemfile dependencies, 3 gems now installed.")
- bundle "config --local without emo obama test"
+ bundle "config set --local without emo obama test"
bundle :install
expect(out).to include(bundle_show_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed")
@@ -55,28 +55,28 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { "./vendor" }
it "shows proper messages according to the configured groups" do
- bundle "config --local path vendor"
+ bundle "config set --local path vendor"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to_not include("Gems in the group")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo test"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo test"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_complete_message)
- bundle "config --local path vendor"
- bundle "config --local without emo obama test"
+ bundle "config set --local path vendor"
+ bundle "config set --local without emo obama test"
bundle :install
expect(out).to include(bundle_show_path_message)
expect(out).to include("Gems in the groups emo, obama and test were not installed")
@@ -88,7 +88,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { bundled_app("cache") }
it "shows proper messages according to the configured groups" do
- bundle "config --local path #{bundle_path}"
+ bundle "config set --local path #{bundle_path}"
bundle :install
expect(out).to include("Bundled gems are installed into `./cache`")
expect(out).to_not include("Gems in the group")
@@ -100,7 +100,7 @@ RSpec.describe "post bundle message" do
let(:bundle_path) { tmp("not_bundled_app") }
it "shows proper messages according to the configured groups" do
- bundle "config --local path #{bundle_path}"
+ bundle "config set --local path #{bundle_path}"
bundle :install
expect(out).to include("Bundled gems are installed into `#{tmp("not_bundled_app")}`")
expect(out).to_not include("Gems in the group")
@@ -193,19 +193,19 @@ The source does not contain any versions of 'not-a-gem'
expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the group emo were not updated")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo test"
+ bundle "config set --local without emo test"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the groups emo and test were not updated")
expect(out).to include(bundle_updated_message)
- bundle "config --local without emo obama test"
+ bundle "config set --local without emo obama test"
bundle :install
bundle :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not updated")
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 357f4512f1..5f4fc71499 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -44,8 +44,8 @@ RSpec.describe "install in deployment or frozen mode" do
it "still works if you are not in the app directory and specify --gemfile" do
bundle "install"
simulate_new_machine
- bundle "config --local deployment true"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local deployment true"
+ bundle "config set --local path vendor/bundle"
bundle "install --gemfile #{tmp}/bundled_app/Gemfile", :dir => tmp
expect(the_bundle).to include_gems "rack 1.0"
end
@@ -58,8 +58,8 @@ RSpec.describe "install in deployment or frozen mode" do
end
G
bundle :install
- bundle "config --local deployment true"
- bundle "config --local without test"
+ bundle "config set --local deployment true"
+ bundle "config set --local without test"
bundle :install
end
@@ -67,7 +67,7 @@ RSpec.describe "install in deployment or frozen mode" do
skip "doesn't find bundle" if Gem.win_platform?
bundle :install
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
bundle "exec bundle check", :env => { "PATH" => path }
end
@@ -81,7 +81,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle :install
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
end
@@ -92,7 +92,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack-obama", ">= 1.0"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
end
@@ -103,7 +103,7 @@ RSpec.describe "install in deployment or frozen mode" do
end
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
expect(the_bundle).to include_gems "rack 1.0"
@@ -111,7 +111,7 @@ RSpec.describe "install in deployment or frozen mode" do
context "when replacing a host with the same host with credentials" do
before do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install"
gemfile <<-G
source "http://user_name:password@localgemserver.test/"
@@ -215,7 +215,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack-obama"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile")
@@ -234,9 +234,9 @@ RSpec.describe "install in deployment or frozen mode" do
expect(the_bundle).to include_gems "path_gem 1.0"
FileUtils.rm_r lib_path("path_gem-1.0")
- bundle "config --local path .bundle"
- bundle "config --local without development"
- bundle "config --local deployment true"
+ bundle "config set --local path .bundle"
+ bundle "config set --local without development"
+ bundle "config set --local deployment true"
bundle :install, :env => { "DEBUG" => "1" }
run "puts :WIN"
expect(out).to eq("WIN")
@@ -252,8 +252,8 @@ RSpec.describe "install in deployment or frozen mode" do
expect(the_bundle).to include_gems "path_gem 1.0"
FileUtils.rm_r lib_path("path_gem-1.0")
- bundle "config --local path .bundle"
- bundle "config --local deployment true"
+ bundle "config set --local path .bundle"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end
@@ -324,7 +324,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "activesupport"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
@@ -338,7 +338,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack", :git => "git://hubz.com"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
@@ -358,7 +358,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "rack"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
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]}")
@@ -382,7 +382,7 @@ RSpec.describe "install in deployment or frozen mode" do
gem "foo", :git => "#{lib_path("rack")}"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
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]})`")
diff --git a/spec/bundler/install/gemfile/eval_gemfile_spec.rb b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
index c42ae7ef79..102f61dc12 100644
--- a/spec/bundler/install/gemfile/eval_gemfile_spec.rb
+++ b/spec/bundler/install/gemfile/eval_gemfile_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do
# parsed lockfile and the evaluated gemfile.
it "bundles with deployment mode configured" do
bundle :install
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
end
end
diff --git a/spec/bundler/install/gemfile/gemspec_spec.rb b/spec/bundler/install/gemfile/gemspec_spec.rb
index 7a95a8abde..b41a083d92 100644
--- a/spec/bundler/install/gemfile/gemspec_spec.rb
+++ b/spec/bundler/install/gemfile/gemspec_spec.rb
@@ -291,7 +291,7 @@ RSpec.describe "bundle install from an existing gemspec" do
s.add_dependency "activesupport", ">= 1.0.1"
end
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :raise_on_error => false
expect(err).to include("changed")
@@ -558,7 +558,7 @@ RSpec.describe "bundle install from an existing gemspec" do
it "installs the ruby platform gemspec and skips dev deps with `without development` configured" do
simulate_platform "ruby"
- bundle "config --local without development"
+ bundle "config set --local without development"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index 7850fad8d0..2e0c0bcf6d 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -128,7 +128,7 @@ RSpec.describe "bundle install with git sources" do
end
it "still works after moving the application directory" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install"
FileUtils.mv bundled_app, tmp("bundled_app.bck")
@@ -137,7 +137,7 @@ RSpec.describe "bundle install with git sources" do
end
it "can still install after moving the application directory" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle "install"
FileUtils.mv bundled_app, tmp("bundled_app.bck")
@@ -1064,7 +1064,7 @@ RSpec.describe "bundle install with git sources" do
simulate_new_machine
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
end
end
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 567a9b1172..f53315e766 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -86,7 +86,7 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
end
@@ -117,7 +117,7 @@ RSpec.describe "bundle install with groups" do
end
it "does not install gems from the excluded group" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default]
end
@@ -130,13 +130,13 @@ RSpec.describe "bundle install with groups" do
end
it "does not say it installed gems from the excluded group" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(out).not_to include("activesupport")
end
it "allows Bundler.setup for specific groups" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
run("require 'rack'; puts RACK", :default)
expect(out).to eq("1.0.0")
@@ -151,7 +151,7 @@ RSpec.describe "bundle install with groups" do
end
G
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default]
end
@@ -188,7 +188,7 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems from the optional group when requested" do
- bundle "config --local with debugging"
+ bundle "config set --local with debugging"
bundle :install
expect(the_bundle).to include_gems "thin 1.0"
end
@@ -214,13 +214,13 @@ RSpec.describe "bundle install with groups" do
end
it "removes groups from without when passed at --with", :bundler => "< 3" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle "install --with emo"
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "removes groups from with when passed at --without", :bundler => "< 3" do
- bundle "config --local with debugging"
+ bundle "config set --local with debugging"
bundle "install --without debugging", :raise_on_error => false
expect(the_bundle).not_to include_gem "thin 1.0"
end
@@ -251,13 +251,13 @@ RSpec.describe "bundle install with groups" do
end
it "has no effect when listing a not optional group in with" do
- bundle "config --local with emo"
+ bundle "config set --local with emo"
bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "has no effect when listing an optional group in without" do
- bundle "config --local without debugging"
+ bundle "config set --local without debugging"
bundle :install
expect(the_bundle).not_to include_gems "thin 1.0"
end
@@ -275,13 +275,13 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle "config --local without emo lolercoaster"
+ bundle "config set --local without emo lolercoaster"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the gem if any of its groups are installed" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
@@ -303,19 +303,19 @@ RSpec.describe "bundle install with groups" do
end
it "installs the gem unless all groups are excluded" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5"
- bundle "config --local without lolercoaster"
+ bundle "config set --local without lolercoaster"
bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5"
- bundle "config --local without emo lolercoaster"
+ bundle "config set --local without emo lolercoaster"
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
- bundle "config --local without 'emo lolercoaster'"
+ bundle "config set --local without 'emo lolercoaster'"
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
@@ -336,13 +336,13 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle "config --local without emo lolercoaster"
+ bundle "config set --local without emo lolercoaster"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the gem if any of its groups are installed" do
- bundle "config --local without emo"
+ bundle "config set --local without emo"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
@@ -380,7 +380,7 @@ RSpec.describe "bundle install with groups" do
system_gems "rack-0.9.1"
- bundle "config --local without rack"
+ bundle "config set --local without rack"
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack"
@@ -404,7 +404,7 @@ RSpec.describe "bundle install with groups" do
it "does not hit the remote a second time" do
FileUtils.rm_rf gem_repo2
- bundle "config --local without rack"
+ bundle "config set --local without rack"
bundle :install, :verbose => true
expect(last_command.stdboth).not_to match(/fetching/i)
end
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index f19fe39721..fc40c5e9b9 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -131,7 +131,7 @@ RSpec.describe "bundle install with explicit source paths" do
gem 'foo', :path => File.expand_path("../foo-1.0", __FILE__)
G
- bundle "config --local frozen true"
+ bundle "config set --local frozen true"
bundle :install
end
diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb
index 46fc393fe9..1a3794dffe 100644
--- a/spec/bundler/install/gemfile/platform_spec.rb
+++ b/spec/bundler/install/gemfile/platform_spec.rb
@@ -291,7 +291,7 @@ RSpec.describe "bundle install across platforms" do
gem "rack", "1.0.0"
G
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
FileUtils.mv(vendored_gems, bundled_app("vendor/bundle", Gem.ruby_engine, "1.8"))
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 655f91dd69..75b7b67e98 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/rack-obama-1.0.gem")).to exist
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0")
@@ -486,7 +486,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem 'bar', '~> 0.1', :source => '#{file_uri_for(gem_repo4)}'
G
- bundle "config --local path ../gems/system"
+ bundle "config set --local path ../gems/system"
bundle :install
# And then we add some new versions...
diff --git a/spec/bundler/install/gems/compact_index_spec.rb b/spec/bundler/install/gems/compact_index_spec.rb
index b5fca9c6ad..92cbd26b88 100644
--- a/spec/bundler/install/gems/compact_index_spec.rb
+++ b/spec/bundler/install/gems/compact_index_spec.rb
@@ -80,8 +80,8 @@ RSpec.describe "compact index api" do
G
bundle :install, :artifice => "compact_index"
- bundle "config --local deployment true"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local deployment true"
+ bundle "config set --local path vendor/bundle"
bundle :install, :artifice => "compact_index"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -118,7 +118,7 @@ RSpec.describe "compact index api" do
bundle :install, :artifice => "compact_index"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index"
expect(the_bundle).to include_gems("rails 2.3.2")
@@ -132,7 +132,7 @@ RSpec.describe "compact index api" do
G
bundle "install", :artifice => "compact_index"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index"
expect(the_bundle).to include_gems("foo 1.0")
@@ -503,7 +503,7 @@ The checksum of /versions does not match the checksum provided by the server! So
G
bundle :install, :artifice => "compact_index_extra"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "compact_index_extra"
expect(the_bundle).to include_gems "back_deps 1.0"
end
diff --git a/spec/bundler/install/gems/dependency_api_spec.rb b/spec/bundler/install/gems/dependency_api_spec.rb
index 5e0be89995..c23323682d 100644
--- a/spec/bundler/install/gems/dependency_api_spec.rb
+++ b/spec/bundler/install/gems/dependency_api_spec.rb
@@ -60,8 +60,8 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle :install, :artifice => "endpoint"
- bundle "config --local deployment true"
- bundle "config --local path vendor/bundle"
+ bundle "config set --local deployment true"
+ bundle "config set --local path vendor/bundle"
bundle :install, :artifice => "endpoint"
expect(out).to include("Fetching gem metadata from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
@@ -98,7 +98,7 @@ RSpec.describe "gemcutter's dependency API" do
bundle :install, :artifice => "endpoint"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint"
expect(the_bundle).to include_gems("rails 2.3.2")
@@ -112,7 +112,7 @@ RSpec.describe "gemcutter's dependency API" do
G
bundle "install", :artifice => "endpoint"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle :install, :artifice => "endpoint"
expect(the_bundle).to include_gems("foo 1.0")
@@ -475,7 +475,7 @@ RSpec.describe "gemcutter's dependency API" do
bundle :install, :artifice => "endpoint_extra"
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
bundle "install", :artifice => "endpoint_extra"
expect(the_bundle).to include_gems "back_deps 1.0"
end
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index 02452f1ef6..1037a98092 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -55,7 +55,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd
end
@@ -71,7 +71,7 @@ RSpec.shared_examples "bundle install --standalone" do
describe "with gems with native extension", :ruby_repo do
before do
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd
source "#{file_uri_for(gem_repo1)}"
gem "very_simple_binary"
@@ -105,7 +105,7 @@ RSpec.shared_examples "bundle install --standalone" do
end
G
end
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
@@ -126,7 +126,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rails"
gem "devise", :git => "#{lib_path("devise-1.0")}"
G
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd
end
@@ -154,7 +154,7 @@ RSpec.shared_examples "bundle install --standalone" do
gem "rack-test"
end
G
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd
end
@@ -168,7 +168,7 @@ RSpec.shared_examples "bundle install --standalone" do
include_examples "common functionality"
it "allows creating a standalone file with limited groups" do
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => "default", :dir => cwd
load_error_ruby <<-RUBY, "spec"
@@ -185,8 +185,8 @@ RSpec.shared_examples "bundle install --standalone" do
end
it "allows `without` configuration to limit the groups used in a standalone" do
- bundle "config --local path #{bundled_app("bundle")}"
- bundle "config --local without test"
+ bundle "config set --local path #{bundled_app("bundle")}"
+ bundle "config set --local without test"
bundle :install, :standalone => true, :dir => cwd
load_error_ruby <<-RUBY, "spec"
@@ -203,7 +203,7 @@ RSpec.shared_examples "bundle install --standalone" do
end
it "allows `path` configuration to change the location of the standalone bundle" do
- bundle "config --local path path/to/bundle"
+ bundle "config set --local path path/to/bundle"
bundle "install", :standalone => true, :dir => cwd
ruby <<-RUBY
@@ -218,9 +218,9 @@ RSpec.shared_examples "bundle install --standalone" do
end
it "allows `without` to limit the groups used in a standalone" do
- bundle "config --local without test"
+ bundle "config set --local without test"
bundle :install, :dir => cwd
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :dir => cwd
load_error_ruby <<-RUBY, "spec"
@@ -246,7 +246,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{source_uri}"
gem "rails"
G
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :artifice => "endpoint", :dir => cwd
end
@@ -267,7 +267,7 @@ RSpec.shared_examples "bundle install --standalone" do
source "#{file_uri_for(gem_repo1)}"
gem "rails"
G
- bundle "config --local path #{bundled_app("bundle")}"
+ bundle "config set --local path #{bundled_app("bundle")}"
bundle :install, :standalone => true, :binstubs => true, :dir => cwd
end
diff --git a/spec/bundler/install/git_spec.rb b/spec/bundler/install/git_spec.rb
index 62658137e0..31c9568f85 100644
--- a/spec/bundler/install/git_spec.rb
+++ b/spec/bundler/install/git_spec.rb
@@ -57,8 +57,8 @@ RSpec.describe "bundle install" do
foo!
L
- bundle "config --local path vendor/bundle"
- bundle "config --local without development"
+ bundle "config set --local path vendor/bundle"
+ bundle "config set --local without development"
bundle :install
expect(out).to include("Bundle complete!")
diff --git a/spec/bundler/install/path_spec.rb b/spec/bundler/install/path_spec.rb
index a05467db12..b0392c4ed2 100644
--- a/spec/bundler/install/path_spec.rb
+++ b/spec/bundler/install/path_spec.rb
@@ -14,14 +14,14 @@ RSpec.describe "bundle install" do
end
it "does not use available system gems with `vendor/bundle" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "uses system gems with `path.system` configured with more priority than `path`" do
- bundle "config --local path.system true"
- bundle "config --global path vendor/bundle"
+ bundle "config set --local path.system true"
+ bundle "config set --global path vendor/bundle"
bundle :install
run "require 'rack'", :raise_on_error => false
expect(out).to include("FAIL")
@@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
dir = bundled_app("bun++dle")
dir.mkpath
- bundle "config --local path #{dir.join("vendor/bundle")}"
+ bundle "config set --local path #{dir.join("vendor/bundle")}"
bundle :install, :dir => dir
expect(out).to include("installed into `./vendor/bundle`")
@@ -39,7 +39,7 @@ RSpec.describe "bundle install" do
end
it "prints a message to let the user know where gems where installed" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
expect(out).to include("gems are installed into `./vendor/bundle`")
end
@@ -109,7 +109,7 @@ RSpec.describe "bundle install" do
context "when set via #{type}" do
it "installs gems to a path if one is specified" do
set_bundle_path(type, bundled_app("vendor2").to_s)
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@@ -159,7 +159,7 @@ RSpec.describe "bundle install" do
end
it "sets BUNDLE_PATH as the first argument to bundle install" do
- bundle "config --local path ./vendor/bundle"
+ bundle "config set --local path ./vendor/bundle"
bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@@ -169,7 +169,7 @@ RSpec.describe "bundle install" do
it "disables system gems when passing a path to install" do
# This is so that vendored gems can be distributed to others
build_gem "rack", "1.1.0", :to_system => true
- bundle "config --local path ./vendor/bundle"
+ bundle "config set --local path ./vendor/bundle"
bundle :install
expect(vendored_gems("gems/rack-1.0.0")).to be_directory
@@ -186,7 +186,7 @@ RSpec.describe "bundle install" do
gem "very_simple_binary"
G
- bundle "config --local path ./vendor/bundle"
+ bundle "config set --local path ./vendor/bundle"
bundle :install
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
@@ -198,7 +198,7 @@ RSpec.describe "bundle install" do
run "require 'very_simple_binary_c'", :raise_on_error => false
expect(err).to include("Bundler::GemNotFound")
- bundle "config --local path ./vendor/bundle"
+ bundle "config set --local path ./vendor/bundle"
bundle :install
expect(vendored_gems("gems/very_simple_binary-1.0")).to be_directory
@@ -218,7 +218,7 @@ RSpec.describe "bundle install" do
gem "rack"
G
- bundle "config --local path bundle"
+ bundle "config set --local path bundle"
bundle :install, :raise_on_error => false
expect(err).to include("file already exists")
end
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index 0d340b070e..af3a10f9e9 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -1202,7 +1202,7 @@ RSpec.describe "the lockfile format" do
gem "omg", :git => "#{lib_path("omg")}", :branch => 'master'
G
- bundle "config --local path vendor"
+ bundle "config set --local path vendor"
bundle :install
expect(the_bundle).to include_gems "omg 1.0"
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 370973ad1a..308f9c79fc 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -228,7 +228,7 @@ RSpec.describe "bundler plugin install" do
gem 'rack', "1.0.0"
G
- bundle "config --local deployment true"
+ bundle "config set --local deployment true"
install_gemfile <<-G
source '#{file_uri_for(gem_repo2)}'
plugin 'foo'
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index 03a377ac93..e2bab9c199 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -132,7 +132,7 @@ RSpec.describe "real source plugins" do
end
it "copies repository to vendor cache and uses it even when installed with `path` configured" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
bundle "config set cache_all true"
bundle :cache
@@ -144,7 +144,7 @@ RSpec.describe "real source plugins" do
end
it "bundler package copies repository to vendor cache" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
bundle "config set cache_all true"
bundle :cache
diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb
index 808f0502a4..405c786842 100644
--- a/spec/bundler/quality_spec.rb
+++ b/spec/bundler/quality_spec.rb
@@ -249,7 +249,7 @@ RSpec.describe "The library itself" do
end
it "does not use require internally, but require_relative" do
- exempt = %r{templates/|man/|vendor/}
+ exempt = %r{templates/|\.5|\.1|vendor/}
all_bad_requires = []
lib_tracked_files.each do |filename|
next if filename =~ exempt
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index ead826c4e6..da1a2ae6e2 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
require 'rack'
@@ -34,7 +34,7 @@ RSpec.describe "Bundler.setup" do
it "doesn't make all groups available" do
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup(:default)
begin
@@ -49,7 +49,7 @@ RSpec.describe "Bundler.setup" do
it "accepts string for group name" do
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup(:default, 'test')
require 'rack'
@@ -61,7 +61,7 @@ RSpec.describe "Bundler.setup" do
it "leaves all groups available if they were already" do
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
Bundler.setup(:default)
@@ -74,7 +74,7 @@ RSpec.describe "Bundler.setup" do
it "leaves :default available if setup is called twice" do
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup(:default)
Bundler.setup(:default, :test)
@@ -91,7 +91,7 @@ RSpec.describe "Bundler.setup" do
it "handles multiple non-additive invocations" do
ruby <<-RUBY, :raise_on_error => false
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup(:default, :test)
Bundler.setup(:default)
require 'rack'
@@ -122,7 +122,7 @@ RSpec.describe "Bundler.setup" do
ENV["RUBYLIB"] = "rubylib_dir"
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
puts $LOAD_PATH
RUBY
@@ -143,6 +143,10 @@ RSpec.describe "Bundler.setup" do
gem "rails"
G
+ # We require an absolute path because relying on the $LOAD_PATH behaves
+ # inconsistently depending on whether we're in a ruby-core setup (and
+ # bundler's lib is in RUBYLIB) or not.
+
ruby <<-RUBY
require '#{lib_dir}/bundler'
Bundler.setup
@@ -171,6 +175,10 @@ RSpec.describe "Bundler.setup" do
gem "terranova"
G
+ # We require an absolute path because relying on the $LOAD_PATH behaves
+ # inconsistently depending on whether we're in a ruby-core setup (and
+ # bundler's lib is in RUBYLIB) or not.
+
ruby <<-RUBY
require '#{lib_dir}/bundler/setup'
puts $LOAD_PATH
@@ -192,8 +200,10 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
+ entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
+
ruby <<-R
- require '#{lib_dir}/bundler'
+ require '#{entrypoint}'
begin
Bundler.setup
@@ -213,7 +223,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R, :raise_on_error => false
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
R
@@ -236,7 +246,7 @@ RSpec.describe "Bundler.setup" do
G
ruby <<-R, :raise_on_error => false
- require '#{lib_dir}/bundler'
+ require 'bundler'
Bundler.setup
R
@@ -289,7 +299,7 @@ RSpec.describe "Bundler.setup" do
ENV["BUNDLE_GEMFILE"] = "Gemfile"
ruby <<-R
- require '#{lib_dir}/bundler'
+ require 'bundler'
begin
Bundler.setup
@@ -444,7 +454,7 @@ RSpec.describe "Bundler.setup" do
break_git!
ruby <<-R
- require '#{lib_dir}/bundler'
+ require 'bundler'
begin
Bundler.setup
@@ -464,8 +474,10 @@ RSpec.describe "Bundler.setup" do
break_git!
+ entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler" : "bundler"
+
ruby <<-R
- require "#{lib_dir}/bundler"
+ require "#{entrypoint}"
begin
Bundler.setup
@@ -481,14 +493,14 @@ RSpec.describe "Bundler.setup" do
end
it "works even when the cache directory has been deleted" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
FileUtils.rm_rf vendored_gems("cache")
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "does not randomly change the path when specifying --path and the bundle directory becomes read only" do
- bundle "config --local path vendor/bundle"
+ bundle "config set --local path vendor/bundle"
bundle :install
with_read_only("#{bundled_app}/**/*") do
@@ -592,7 +604,7 @@ RSpec.describe "Bundler.setup" do
describe "when excluding groups" do
it "doesn't change the resolve if --without is used" do
- bundle "config --local without rails"
+ bundle "config set --local without rails"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "activesupport"
@@ -608,7 +620,7 @@ RSpec.describe "Bundler.setup" do
end
it "remembers --without and does not bail on bare Bundler.setup" do
- bundle "config --local without rails"
+ bundle "config set --local without rails"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "activesupport"
@@ -624,7 +636,7 @@ RSpec.describe "Bundler.setup" do
end
it "remembers --without and does not bail on bare Bundler.setup, even in the case of path gems no longer available" do
- bundle "config --local without development"
+ bundle "config set --local without development"
path = bundled_app(File.join("vendor", "foo"))
build_lib "foo", :path => path
@@ -644,7 +656,7 @@ RSpec.describe "Bundler.setup" do
end
it "remembers --without and does not include groups passed to Bundler.setup" do
- bundle "config --local without rails"
+ bundle "config set --local without rails"
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "activesupport"
@@ -798,7 +810,7 @@ end
# Don't build extensions.
s.class.send(:define_method, :build_extensions) { nil }
- require '#{lib_dir}/bundler'
+ require 'bundler'
gem '#{gem_name}'
puts $LOAD_PATH.count {|path| path =~ /#{gem_name}/} >= 2
@@ -1056,7 +1068,7 @@ end
bundle "install"
ruby <<-RUBY
- require '#{lib_dir}/bundler'
+ require 'bundler'
bundler_module = class << Bundler; self; end
bundler_module.send(:remove_method, :require)
def Bundler.require(path)
@@ -1104,6 +1116,8 @@ end
end
before do
+ bundle "config set --local path.system true"
+
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@@ -1112,8 +1126,9 @@ end
context "is not present" do
it "does not change the lock" do
+ entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
lockfile lock_with(nil)
- ruby "require '#{lib_dir}/bundler/setup'"
+ ruby "require '#{entrypoint}'"
lockfile_should_be lock_with(nil)
end
end
@@ -1121,7 +1136,7 @@ end
context "is newer" do
it "does not change the lock or warn" do
lockfile lock_with(Bundler::VERSION.succ)
- ruby "require '#{lib_dir}/bundler/setup'"
+ ruby "require 'bundler/setup'"
expect(out).to be_empty
expect(err).to be_empty
lockfile_should_be lock_with(Bundler::VERSION.succ)
@@ -1130,8 +1145,10 @@ end
context "is older" do
it "does not change the lock" do
+ entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
+ system_gems "bundler-1.10.1"
lockfile lock_with("1.10.1")
- ruby "require '#{lib_dir}/bundler/setup'"
+ ruby "require '#{entrypoint}'"
lockfile_should_be lock_with("1.10.1")
end
end
@@ -1178,14 +1195,14 @@ end
context "is not present" do
it "does not change the lock" do
- expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
end
end
context "is newer" do
let(:ruby_version) { "5.5.5" }
it "does not change the lock or warn" do
- expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
expect(out).to be_empty
expect(err).to be_empty
end
@@ -1194,7 +1211,7 @@ end
context "is older" do
let(:ruby_version) { "1.0.0" }
it "does not change the lock" do
- expect { ruby "require '#{lib_dir}/bundler/setup'" }.not_to change { lockfile }
+ expect { ruby "require 'bundler/setup'" }.not_to change { lockfile }
end
end
end
@@ -1202,8 +1219,9 @@ end
describe "with gemified standard libraries" do
it "does not load Psych" do
gemfile ""
+ entrypoint = mis_activates_prerelease_default_bundler? ? "#{lib_dir}/bundler/setup" : "bundler/setup"
ruby <<-RUBY
- require '#{lib_dir}/bundler/setup'
+ require '#{entrypoint}'
puts defined?(Psych::VERSION) ? Psych::VERSION : "undefined"
require 'psych'
puts Psych::VERSION
@@ -1216,7 +1234,7 @@ end
it "does not load openssl" do
install_gemfile ""
ruby <<-RUBY
- require "#{lib_dir}/bundler/setup"
+ require "bundler/setup"
puts defined?(OpenSSL) || "undefined"
require "openssl"
puts defined?(OpenSSL) || "undefined"
@@ -1274,7 +1292,7 @@ end
it "activates no gems with -rbundler/setup" do
install_gemfile ""
- ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -r#{lib_dir}/bundler/setup" }
+ ruby code, :env => { "RUBYOPT" => activation_warning_hack_rubyopt + " -rbundler/setup" }
expect(out).to eq("{}")
end
@@ -1327,7 +1345,7 @@ end
if File.exist?(ext_folder.join("#{require_name}.rb"))
{ :exclude_from_load_path => ext_folder.to_s }
else
- lib_folder = source_root.join("lib")
+ lib_folder = source_lib_dir
if File.exist?(lib_folder.join("#{require_name}.rb"))
{ :exclude_from_load_path => lib_folder.to_s }
else
@@ -1383,7 +1401,7 @@ end
G
ruby <<-RUBY
- require "#{lib_dir}/bundler/setup"
+ require "bundler/setup"
Object.new.gem "rack"
puts Gem.loaded_specs["rack"].full_name
RUBY
@@ -1398,7 +1416,7 @@ end
G
ruby <<-RUBY, :raise_on_error => false
- require "#{lib_dir}/bundler/setup"
+ require "bundler/setup"
Object.new.gem "rack"
puts "FAIL"
RUBY
@@ -1414,7 +1432,7 @@ end
G
ruby <<-RUBY, :raise_on_error => false
- require "#{lib_dir}/bundler/setup"
+ require "bundler/setup"
Object.new.require "rack"
puts "FAIL"
RUBY
@@ -1429,4 +1447,9 @@ end
expect(last_command.stdboth).to eq("true")
end
end
+
+ # Tested rubygems does not include https://github.com/rubygems/rubygems/pull/2728 and will not always end up activating the current bundler
+ def mis_activates_prerelease_default_bundler?
+ Gem.rubygems_version < Gem::Version.new("3.1.a")
+ end
end
diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb
index a259100b2a..7723c85ce6 100644
--- a/spec/bundler/spec_helper.rb
+++ b/spec/bundler/spec_helper.rb
@@ -13,6 +13,7 @@ require "bundler"
require "rspec/core"
require "rspec/expectations"
require "rspec/mocks"
+require "diff/lcs"
require_relative "support/builders"
require_relative "support/build_metadata"
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 305ea0a876..56d3c71f3c 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -63,6 +63,10 @@ module Spec
@spec_dir ||= source_root.join(ruby_core? ? "spec/bundler" : "spec")
end
+ def man_dir
+ @man_dir ||= lib_dir.join("bundler/man")
+ end
+
def tracked_files
@tracked_files ||= git_ls_files(tracked_files_glob)
end
@@ -236,7 +240,7 @@ module Spec
end
def man_tracked_files_glob
- ruby_core? ? "man/bundle* man/gemfile*" : "man"
+ ruby_core? ? "man/bundle* man/gemfile*" : "lib/bundler/man/bundle*.1 lib/bundler/man/gemfile*.5"
end
def git_root
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index d743a76391..55f20ff29a 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -71,6 +71,26 @@ module Spec
install_gems(test_gemfile, test_lockfile)
end
+ def check_source_control_changes(success_message:, error_message:)
+ require "open3"
+
+ output, status = Open3.capture2e("git status --porcelain")
+
+ if status.success? && output.empty?
+ puts
+ puts success_message
+ puts
+ else
+ system("git status --porcelain")
+
+ puts
+ puts error_message
+ puts
+
+ exit(1)
+ end
+ end
+
private
# Some rubygems versions include loaded specs when loading gemspec stubs
diff --git a/spec/bundler/support/streams.rb b/spec/bundler/support/streams.rb
deleted file mode 100644
index a947eebf6f..0000000000
--- a/spec/bundler/support/streams.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# frozen_string_literal: true
-
-require "stringio"
-
-def capture(*args)
- opts = args.pop if args.last.is_a?(Hash)
- opts ||= {}
-
- args.map!(&:to_s)
- begin
- result = StringIO.new
- result.close if opts[:closed]
- args.each {|stream| eval "$#{stream} = result" }
- yield
- ensure
- args.each {|stream| eval("$#{stream} = #{stream.upcase}") }
- end
- result.string
-end