summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/bundler/cli_spec.rb8
-rw-r--r--spec/cache/gems_spec.rb2
-rw-r--r--spec/cache/git_spec.rb6
-rw-r--r--spec/cache/platform_spec.rb8
-rw-r--r--spec/commands/check_spec.rb6
-rw-r--r--spec/commands/clean_spec.rb26
-rw-r--r--spec/commands/exec_spec.rb23
-rw-r--r--spec/commands/init_spec.rb39
-rw-r--r--spec/commands/install_spec.rb3
-rw-r--r--spec/commands/newgem_spec.rb16
-rw-r--r--spec/commands/update_spec.rb118
-rw-r--r--spec/install/bundler_spec.rb12
-rw-r--r--spec/install/failure_spec.rb2
-rw-r--r--spec/install/gemfile/gemspec_spec.rb10
-rw-r--r--spec/install/gemfile/git_spec.rb32
-rw-r--r--spec/install/gemfile/groups_spec.rb4
-rw-r--r--spec/install/gems/compact_index_spec.rb2
-rw-r--r--spec/install/gems/dependency_api_spec.rb2
-rw-r--r--spec/install/gems/flex_spec.rb4
-rw-r--r--spec/install/gems/resolving_spec.rb5
-rw-r--r--spec/install/git_spec.rb4
-rw-r--r--spec/lock/lockfile_spec.rb16
-rw-r--r--spec/update/gems/post_install_spec.rb4
-rw-r--r--spec/update/git_spec.rb11
24 files changed, 214 insertions, 149 deletions
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 5519b9bbb1..5df50c94ec 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -57,12 +57,12 @@ RSpec.describe "bundle executable" do
context "with --verbose" do
it "prints the running command" do
bundle! "config", :verbose => true
- expect(out).to start_with("Running `bundle config --verbose` with bundler #{Bundler::VERSION}")
+ expect(last_command.stdout).to start_with("Running `bundle config --verbose` with bundler #{Bundler::VERSION}")
end
it "doesn't print defaults" do
install_gemfile! "", :verbose => true
- expect(out).to start_with("Running `bundle install --no-color --retry 0 --verbose` with bundler #{Bundler::VERSION}")
+ expect(last_command.stdout).to start_with("Running `bundle install --no-color --retry 0 --verbose` with bundler #{Bundler::VERSION}")
end
end
@@ -103,7 +103,7 @@ RSpec.describe "bundle executable" do
let(:latest_version) { "2.0" }
it "prints the version warning" do
bundle "fail"
- expect(last_command.bundler_err).to start_with(<<-EOS.strip)
+ expect(last_command.stdout).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To update, run `gem install bundler`
EOS
@@ -118,7 +118,7 @@ To update, run `gem install bundler`
let(:latest_version) { "2.0.0.pre.4" }
it "prints the version warning" do
bundle "fail"
- expect(last_command.bundler_err).to start_with(<<-EOS.strip)
+ expect(last_command.stdout).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To update, run `gem install bundler --pre`
EOS
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb
index 6283299b57..aef4c5f05a 100644
--- a/spec/cache/gems_spec.rb
+++ b/spec/cache/gems_spec.rb
@@ -183,7 +183,7 @@ RSpec.describe "bundle cache" do
it "adds and removes when gems are updated" do
update_repo2
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(cached_gem("rack-1.2")).to exist
expect(cached_gem("rack-1.0.0")).not_to exist
end
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb
index 8f12028ffc..b780b19376 100644
--- a/spec/cache/git_spec.rb
+++ b/spec/cache/git_spec.rb
@@ -81,14 +81,14 @@ end
ref = git.ref_for("master", 11)
expect(ref).not_to eq(old_ref)
- bundle "update"
- bundle "#{cmd} --all"
+ bundle! "update", :all => bundle_update_requires_all?
+ bundle! "#{cmd} --all"
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
FileUtils.rm_rf lib_path("foo-1.0")
- run "require 'foo'"
+ run! "require 'foo'"
expect(out).to eq("CACHE")
end
diff --git a/spec/cache/platform_spec.rb b/spec/cache/platform_spec.rb
index cb2b610436..c0622a3c94 100644
--- a/spec/cache/platform_spec.rb
+++ b/spec/cache/platform_spec.rb
@@ -34,18 +34,14 @@ RSpec.describe "bundle cache with multiple platforms" do
end
it "ensures that a successful bundle install does not delete gems for other platforms" do
- bundle "install"
-
- expect(exitstatus).to eq 0 if exitstatus
+ bundle! "install"
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist
end
it "ensures that a successful bundle update does not delete gems for other platforms" do
- bundle "update"
-
- expect(exitstatus).to eq 0 if exitstatus
+ bundle! "update", :all => bundle_update_requires_all?
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index 23a7ea137a..324959c0e0 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -210,7 +210,6 @@ RSpec.describe "bundle check" do
3.times do
bundle :check
expect(out).to eq(last_out)
- expect(err).to lack_errors
end
end
@@ -329,9 +328,8 @@ RSpec.describe "bundle check" do
context "is newer" do
it "does not change the lock but warns" do
lockfile lock_with(Bundler::VERSION.succ)
- bundle :check
- expect(out).to include("the running version of Bundler (#{Bundler::VERSION}) is older than the version that created the lockfile (#{Bundler::VERSION.succ})")
- expect(err).to lack_errors
+ bundle! :check
+ expect(last_command.bundler_err).to include("the running version of Bundler (#{Bundler::VERSION}) is older than the version that created the lockfile (#{Bundler::VERSION.succ})")
lockfile_should_be lock_with(Bundler::VERSION.succ)
end
end
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index 9323e2d22e..3f3dc8565d 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe "bundle clean" do
gem "foo"
G
- bundle "install --path vendor/bundle --no-clean"
+ bundle! "install --path vendor/bundle --no-clean"
gemfile <<-G
source "file://#{gem_repo1}"
@@ -88,9 +88,9 @@ RSpec.describe "bundle clean" do
gem "rack", "0.9.1"
gem "foo"
G
- bundle "install"
+ bundle! "update rack"
- bundle :clean
+ bundle! :clean
expect(out).to include("Removing rack (1.0.0)")
@@ -195,13 +195,13 @@ RSpec.describe "bundle clean" do
end
G
- bundle "install --path vendor/bundle"
+ bundle! "install --path vendor/bundle"
update_git "foo", :path => lib_path("foo-bar")
revision2 = revision_for(lib_path("foo-bar"))
- bundle "update"
- bundle :clean
+ bundle! "update", :all => bundle_update_requires_all?
+ bundle! :clean
expect(out).to include("Removing foo-bar (#{revision[0..11]})")
@@ -366,13 +366,13 @@ RSpec.describe "bundle clean" do
gem "foo"
G
- bundle "install --path vendor/bundle --clean"
+ bundle! "install --path vendor/bundle --clean"
update_repo2 do
build_gem "foo", "1.0.1"
end
- bundle "update"
+ bundle! "update", :all => bundle_update_requires_all?
should_have_gems "foo-1.0.1"
should_not_have_gems "foo-1.0"
@@ -405,13 +405,13 @@ RSpec.describe "bundle clean" do
gem "foo"
G
- bundle "install --path vendor/bundle"
+ bundle! "install --path vendor/bundle"
update_repo2 do
build_gem "foo", "1.0.1"
end
- bundle :update
+ bundle! :update, :all => bundle_update_requires_all?
should_have_gems "foo-1.0", "foo-1.0.1"
end
@@ -423,14 +423,14 @@ RSpec.describe "bundle clean" do
gem "foo"
G
- bundle "install"
+ bundle! "install"
update_repo2 do
build_gem "foo", "1.0.1"
end
- bundle :update
+ bundle! :update, :all => bundle_update_requires_all?
- sys_exec "gem list"
+ sys_exec! "gem list"
expect(out).to include("foo (1.0.1, 1.0)")
end
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 1d9e5f2ed5..cc5989790e 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -539,7 +539,7 @@ RSpec.describe "bundle exec" do
end
end
- context "the executable is empty" do
+ context "the executable is empty", :bundler => "< 2" do
let(:executable) { "" }
let(:exit_code) { 0 }
@@ -554,7 +554,16 @@ RSpec.describe "bundle exec" do
end
end
- context "the executable raises" do
+ context "the executable is empty", :bundler => "2" do
+ let(:executable) { "" }
+
+ let(:exit_code) { 0 }
+ let(:expected_err) { "#{path} is empty" }
+ let(:expected) { "" }
+ it_behaves_like "it runs"
+ end
+
+ context "the executable raises", :bundler => "< 2" do
let(:executable) { super() << "\nraise 'ERROR'" }
let(:exit_code) { 1 }
let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" }
@@ -565,6 +574,16 @@ RSpec.describe "bundle exec" do
it_behaves_like "it runs"
end
+ context "the executable raises", :bundler => "2" do
+ let(:executable) { super() << "\nraise 'ERROR'" }
+ let(:exit_code) { 1 }
+ let(:expected_err) do
+ "bundler: failed to load command: #{path} (#{path})" \
+ "\nRuntimeError: ERROR\n #{path}:10:in `<top (required)>'"
+ end
+ it_behaves_like "it runs"
+ end
+
context "when the file uses the current ruby shebang" do
let(:shebang) { "#!#{Gem.ruby}" }
it_behaves_like "it runs"
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb
index 7be379b510..abcdd6ab92 100644
--- a/spec/commands/init_spec.rb
+++ b/spec/commands/init_spec.rb
@@ -1,14 +1,16 @@
# frozen_string_literal: true
RSpec.describe "bundle init" do
- it "generates a Gemfile" do
- bundle :init
- expect(bundled_app("Gemfile")).to exist
+ it "generates a Gemfile", :bundler => "< 2" do
+ bundle! :init
+ expect(out).to include("Writing new Gemfile")
+ expect(bundled_app("Gemfile")).to be_file
end
- it "prints a message to the user" do
- bundle :init
- expect(out).to include("Writing new Gemfile")
+ it "generates a gems.rb", :bundler => "2" do
+ bundle! :init
+ expect(out).to include("Writing new gems.rb")
+ expect(bundled_app("gems.rb")).to be_file
end
context "when a Gemfile already exists" do
@@ -28,6 +30,23 @@ RSpec.describe "bundle init" do
end
end
+ context "when a gems.rb already exists" do
+ before do
+ create_file "gems.rb", <<-G
+ gem "rails"
+ G
+ end
+
+ it "does not change existing gem.rb files" do
+ expect { bundle :init }.not_to change { File.read(bundled_app("gems.rb")) }
+ end
+
+ it "notifies the user that an existing gems.rb already exists" do
+ bundle :init
+ expect(out).to include("gems.rb already exists")
+ end
+ end
+
context "given --gemspec option" do
let(:spec_file) { tmp.join("test.gemspec") }
@@ -44,7 +63,11 @@ RSpec.describe "bundle init" do
bundle :init, :gemspec => spec_file
- gemfile = bundled_app("Gemfile").read
+ gemfile = if Bundler::VERSION[0, 2] == "1."
+ bundled_app("Gemfile").read
+ else
+ bundled_app("gems.rb").read
+ end
expect(gemfile).to match(%r{source 'https://rubygems.org'})
expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1)
expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1)
@@ -63,7 +86,7 @@ RSpec.describe "bundle init" do
end
bundle :init, :gemspec => spec_file
- expect(out).to include("There was an error while loading `test.gemspec`")
+ expect(last_command.bundler_err).to include("There was an error while loading `test.gemspec`")
end
end
end
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index 3b339e5147..5be6c40a44 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -16,8 +16,7 @@ RSpec.describe "bundle install with gem sources" do
raise StandardError, "FAIL"
G
- expect(err).to lack_errors
- expect(out).to match(/StandardError, "FAIL"/)
+ expect(last_command.bundler_err).to include('StandardError, "FAIL"')
expect(bundled_app("Gemfile.lock")).not_to exist
end
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 2488196abb..ebca2a2ddd 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -785,22 +785,22 @@ RSpec.describe "bundle gem" do
it "fails gracefully with a ." do
bundle "gem foo.gemspec"
- expect(out).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name")
+ expect(last_command.bundler_err).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name")
end
it "fails gracefully with a ^" do
bundle "gem ^"
- expect(out).to end_with("Invalid gem name ^ -- `^` is an invalid constant name")
+ expect(last_command.bundler_err).to end_with("Invalid gem name ^ -- `^` is an invalid constant name")
end
it "fails gracefully with a space" do
bundle "gem 'foo bar'"
- expect(out).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name")
+ expect(last_command.bundler_err).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name")
end
it "fails gracefully when multiple names are passed" do
bundle "gem foo bar baz"
- expect(out).to eq(<<-E.strip)
+ expect(last_command.bundler_err).to eq(<<-E.strip)
ERROR: "bundle gem" was called with arguments ["foo", "bar", "baz"]
Usage: "bundle gem GEM [OPTIONS]"
E
@@ -890,8 +890,8 @@ Usage: "bundle gem GEM [OPTIONS]"
in_app_root do
FileUtils.touch("conflict-foobar")
end
- output = bundle "gem conflict-foobar"
- expect(output).to include("Errno::EEXIST")
+ bundle "gem conflict-foobar"
+ expect(last_command.bundler_err).to include("Errno::EEXIST")
expect(exitstatus).to eql(32) if exitstatus
end
end
@@ -901,8 +901,8 @@ Usage: "bundle gem GEM [OPTIONS]"
in_app_root do
FileUtils.mkdir_p("conflict-foobar/Gemfile")
end
- output = bundle "gem conflict-foobar"
- expect(output).to include("Errno::EISDIR")
+ bundle "gem conflict-foobar"
+ expect(last_command.bundler_err).to include("Errno::EISDIR")
expect(exitstatus).to eql(32) if exitstatus
end
end
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index ce3eede732..c08a10c24c 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe "bundle update" do
G
end
- describe "with no arguments" do
+ describe "with no arguments", :bundler => "< 2" do
it "updates the entire bundle" do
update_repo2 do
build_gem "activesupport", "3.0"
@@ -34,6 +34,29 @@ RSpec.describe "bundle update" do
end
end
+ describe "with --all", :bundler => "2" do
+ it "updates the entire bundle" do
+ update_repo2 do
+ build_gem "activesupport", "3.0"
+ end
+
+ bundle! "update", :all => true
+ expect(out).to include("Bundle updated!")
+ expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
+ end
+
+ it "doesn't delete the Gemfile.lock file if something goes wrong" do
+ gemfile <<-G
+ source "file://#{gem_repo2}"
+ gem "activesupport"
+ gem "rack-obama"
+ exit!
+ G
+ bundle "update", :all => true
+ expect(bundled_app("Gemfile.lock")).to exist
+ end
+ end
+
context "when update_requires_all_flag is set" do
before { bundle! "config update_requires_all_flag true" }
@@ -122,7 +145,7 @@ RSpec.describe "bundle update" do
end
end
- bundle! "update"
+ bundle! "update", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems("a 1.0", "b 1.0", "c 2.0")
end
@@ -133,8 +156,8 @@ RSpec.describe "bundle update" do
it "doesn't hit repo2" do
FileUtils.rm_rf(gem_repo2)
- bundle "update --local"
- expect(out).not_to match(/Fetching source index/)
+ bundle "update --local --all"
+ expect(out).not_to include("Fetching source index")
end
end
@@ -176,8 +199,8 @@ RSpec.describe "bundle update" do
describe "in a frozen bundle" do
it "should fail loudly" do
- bundle "install --deployment"
- bundle "update"
+ bundle! "install --deployment"
+ bundle "update", :all => bundle_update_requires_all?
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
expect(out).to match(/freeze \nby running `bundle install --no-deployment`./m)
@@ -185,36 +208,34 @@ RSpec.describe "bundle update" do
end
it "should suggest different command when frozen is set globally" do
- bundler "config --global frozen 1"
- bundle "update"
+ bundle! "config --global frozen 1"
+ bundle "update", :all => bundle_update_requires_all?
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
expect(out).to match(/freeze \nby running `bundle config --delete frozen`./m)
end
end
describe "with --source option" do
- it "should not update gems not included in the source that happen to have the same name" do
- pending("Allowed to fail to preserve backwards-compatibility")
-
- install_gemfile <<-G
+ it "should not update gems not included in the source that happen to have the same name", :bundler => "< 2" do
+ install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "activesupport"
G
update_repo2 { build_gem "activesupport", "3.0" }
- bundle "update --source activesupport"
- expect(the_bundle).not_to include_gems "activesupport 3.0"
+ bundle! "update --source activesupport"
+ expect(the_bundle).to include_gem "activesupport 3.0"
end
- it "should update gems not included in the source that happen to have the same name" do
- install_gemfile <<-G
+ it "should not update gems not included in the source that happen to have the same name", :bundler => "2" do
+ install_gemfile! <<-G
source "file://#{gem_repo2}"
gem "activesupport"
G
update_repo2 { build_gem "activesupport", "3.0" }
- bundle "update --source activesupport"
- expect(the_bundle).to include_gems "activesupport 3.0"
+ bundle! "update --source activesupport"
+ expect(the_bundle).not_to include_gem "activesupport 3.0"
end
context "with unlock_source_unlocks_spec set to false" do
@@ -249,7 +270,7 @@ RSpec.describe "bundle update" do
G
end
- it "should not update the child dependencies of a gem that has the same name as the source" do
+ it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do
update_repo2 do
build_gem "fred", "2.0"
build_gem "harry", "2.0" do |s|
@@ -261,6 +282,18 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gems "harry 2.0"
expect(the_bundle).to include_gems "fred 1.0"
end
+
+ it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do
+ update_repo2 do
+ build_gem "fred", "2.0"
+ build_gem "harry", "2.0" do |s|
+ s.add_dependency "fred"
+ end
+ end
+
+ bundle "update --source harry"
+ expect(the_bundle).to include_gems "harry 1.0", "fred 1.0"
+ end
end
context "when there is a child dependency that appears elsewhere in the dependency graph" do
@@ -282,7 +315,7 @@ RSpec.describe "bundle update" do
G
end
- it "should not update the child dependencies of a gem that has the same name as the source" do
+ it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "< 2" do
update_repo2 do
build_gem "george", "2.0"
build_gem "harry", "2.0" do |s|
@@ -295,6 +328,18 @@ RSpec.describe "bundle update" do
expect(the_bundle).to include_gems "fred 1.0"
expect(the_bundle).to include_gems "george 1.0"
end
+
+ it "should not update the child dependencies of a gem that has the same name as the source", :bundler => "2" do
+ update_repo2 do
+ build_gem "george", "2.0"
+ build_gem "harry", "2.0" do |s|
+ s.add_dependency "george"
+ end
+ end
+
+ bundle "update --source harry"
+ expect(the_bundle).to include_gems "harry 1.0", "fred 1.0", "george 1.0"
+ end
end
end
@@ -349,7 +394,7 @@ RSpec.describe "bundle update without a Gemfile.lock" do
gem "rack", "1.0"
G
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "rack 1.0.0"
end
@@ -369,16 +414,11 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
G
end
- it "should not explode" do
- bundle "update"
- expect(err).to lack_errors
- end
-
it "should explain that bundler conflicted" do
- bundle "update"
- expect(out).not_to match(/in snapshot/i)
- expect(out).to match(/current Bundler version/i)
- expect(out).to match(/perhaps you need to update bundler/i)
+ bundle "update", :all => bundle_update_requires_all?
+ expect(last_command.stdboth).not_to match(/in snapshot/i)
+ expect(last_command.bundler_err).to match(/current Bundler version/i).
+ and match(/perhaps you need to update bundler/i)
end
end
@@ -391,14 +431,14 @@ RSpec.describe "bundle update" do
gem "activesupport"
G
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(out).to include("Using activesupport 2.3.5")
update_repo2 do
build_gem "activesupport", "3.0"
end
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(out).to include("Installing activesupport 3.0 (was 2.3.5)")
end
@@ -560,13 +600,13 @@ RSpec.describe "bundle update conservative" do
context "patch preferred" do
it "single gem updates dependent gem to minor" do
- bundle "update --patch foo"
+ bundle! "update --patch foo"
expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.0"
end
it "update all" do
- bundle "update --patch"
+ bundle! "update --patch", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.1"
end
@@ -574,7 +614,7 @@ RSpec.describe "bundle update conservative" do
context "minor preferred" do
it "single gem updates dependent gem to major" do
- bundle "update --minor foo"
+ bundle! "update --minor foo"
expect(the_bundle).to include_gems "foo 1.5.1", "bar 3.0.0", "qux 1.0.0"
end
@@ -582,13 +622,13 @@ RSpec.describe "bundle update conservative" do
context "strict" do
it "patch preferred" do
- bundle "update --patch foo bar --strict"
+ bundle! "update --patch foo bar --strict"
expect(the_bundle).to include_gems "foo 1.4.4", "bar 2.0.5", "qux 1.0.0"
end
it "minor preferred" do
- bundle "update --minor --strict"
+ bundle! "update --minor --strict", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "foo 1.5.0", "bar 2.1.1", "qux 1.1.0"
end
@@ -685,9 +725,9 @@ RSpec.describe "bundle update conservative" do
end
it "raises if too many flags are provided" do
- bundle "update --patch --minor"
+ bundle "update --patch --minor", :all => bundle_update_requires_all?
- expect(out).to eq "Provide only one of the following options: minor, patch"
+ expect(last_command.bundler_err).to eq "Provide only one of the following options: minor, patch"
end
end
end
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index ca17d19abd..69f85f4964 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -37,8 +37,6 @@ RSpec.describe "bundle install" do
G
nice_error = <<-E.strip.gsub(/^ {8}/, "")
- Fetching source index from file:#{gem_repo2}/
- Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (= 0.9.2)
@@ -50,7 +48,7 @@ RSpec.describe "bundle install" do
Could not find gem 'bundler (= 0.9.2)' in any of the sources
E
- expect(out).to eq(nice_error)
+ expect(last_command.bundler_err).to include(nice_error)
end
it "works for gems with multiple versions in its dependencies" do
@@ -98,8 +96,6 @@ RSpec.describe "bundle install" do
G
nice_error = <<-E.strip.gsub(/^ {8}/, "")
- Fetching source index from file:#{gem_repo2}/
- Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
activemerchant was resolved to 1.0, which depends on
@@ -108,7 +104,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(out).to include(nice_error)
+ expect(last_command.bundler_err).to include(nice_error)
end
it "causes a conflict if a child dependency conflicts with the Gemfile" do
@@ -119,8 +115,6 @@ RSpec.describe "bundle install" do
G
nice_error = <<-E.strip.gsub(/^ {8}/, "")
- Fetching source index from file:#{gem_repo2}/
- Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
activesupport (= 2.3.5)
@@ -128,7 +122,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(out).to include(nice_error)
+ expect(last_command.bundler_err).to include(nice_error)
end
it "can install dependencies with newer bundler version" do
diff --git a/spec/install/failure_spec.rb b/spec/install/failure_spec.rb
index c4568673f8..896138c659 100644
--- a/spec/install/failure_spec.rb
+++ b/spec/install/failure_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe "bundle install" do
source "file:#{gem_repo2}"
gem "rails"
G
- expect(out).to end_with(<<-M.strip)
+ expect(last_command.bundler_err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
Make sure that `gem install activesupport -v '2.3.2'` succeeds before bundling.
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb
index 5089914959..4f1a69688c 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -57,11 +57,11 @@ RSpec.describe "bundle install from an existing gemspec" do
it "should raise if there are no gemspecs available" do
build_lib("foo", :path => tmp.join("foo"), :gemspec => false)
- error = install_gemfile(<<-G)
+ install_gemfile(<<-G)
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(error).to match(/There are no gemspecs at #{tmp.join('foo')}/)
+ expect(last_command.bundler_err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
end
it "should raise if there are too many gemspecs available" do
@@ -69,11 +69,11 @@ RSpec.describe "bundle install from an existing gemspec" do
s.write("foo2.gemspec", build_spec("foo", "4.0").first.to_ruby)
end
- error = install_gemfile(<<-G)
+ install_gemfile(<<-G)
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(error).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
+ expect(last_command.bundler_err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
end
it "should pick a specific gemspec" do
@@ -188,7 +188,7 @@ RSpec.describe "bundle install from an existing gemspec" do
install_gemfile <<-G
gemspec :path => '#{tmp.join("foo")}'
G
- expect(@err).not_to match(/ahh/)
+ expect(last_command.stdboth).not_to include("ahh")
end
it "allows the gemspec to activate other gems" do
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index 59bbc9c016..ab66337ffa 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -275,7 +275,7 @@ 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
- `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
install_gemfile! <<-G
@@ -285,10 +285,10 @@ RSpec.describe "bundle install with git sources" do
G
# ensure we also git fetch after cloning
- bundle! :update
+ bundle! :update, :all => bundle_update_requires_all?
Dir.chdir(Dir[system_gem_path("cache/bundler/git/foo-*")].first) do
- @out = sys_exec("git ls-remote .")
+ sys_exec("git ls-remote .")
end
expect(out).not_to include("refs/bundler/1")
@@ -790,14 +790,14 @@ RSpec.describe "bundle install with git sources" do
s.write "lib/forced.rb", "FORCED = '1.1'"
end
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "forced 1.1"
Dir.chdir(lib_path("forced-1.0")) do
`git reset --hard HEAD^`
end
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "forced 1.0"
end
@@ -1176,7 +1176,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
- expect(out).to end_with(<<-M.strip)
+ expect(last_command.bundler_err).to end_with(<<-M.strip)
An error occurred while installing foo (1.0), and Bundler cannot continue.
In Gemfile:
@@ -1260,9 +1260,10 @@ In Gemfile:
G
with_path_as("") do
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
end
- expect(out).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")
+ 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")
end
it "installs a packaged git gem successfully" do
@@ -1276,15 +1277,14 @@ In Gemfile:
bundle "package --all"
simulate_new_machine
- bundle "install", :env => { "PATH" => "" }
+ bundle! "install", :env => { "PATH" => "" }
expect(out).to_not include("You need to install git to be able to use gems from git repositories.")
- expect(exitstatus).to be_zero if exitstatus
end
end
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 --global local.foo #{lib_path("foo")}"
end
describe "and git output is colorized" do
@@ -1319,9 +1319,8 @@ In Gemfile:
G
bundle :install
- expect(out).to_not include("password1")
- expect(err).to_not include("password1")
- expect(out).to include("Fetching https://user1@github.com/company/private-repo")
+ expect(last_command.stdboth).to_not include("password1")
+ expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo")
end
end
@@ -1336,9 +1335,8 @@ In Gemfile:
G
bundle :install
- expect(out).to_not include("oauth_token")
- expect(err).to_not include("oauth_token")
- expect(out).to include("Fetching https://x-oauth-basic@github.com/company/private-repo")
+ 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
end
end
diff --git a/spec/install/gemfile/groups_spec.rb b/spec/install/gemfile/groups_spec.rb
index ed264d8439..b49b64d1f0 100644
--- a/spec/install/gemfile/groups_spec.rb
+++ b/spec/install/gemfile/groups_spec.rb
@@ -363,8 +363,8 @@ RSpec.describe "bundle install with groups" do
it "does not hit the remote a second time" do
FileUtils.rm_rf gem_repo2
- bundle! "install --without rack"
- expect(out).not_to include "Fetching"
+ bundle! "install --without rack", :verbose => true
+ expect(last_command.stdboth).not_to match(/fetching/i)
end
end
end
diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb
index c42816a3fb..9fc5b1f90a 100644
--- a/spec/install/gems/compact_index_spec.rb
+++ b/spec/install/gems/compact_index_spec.rb
@@ -248,7 +248,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"
+ bundle! "update --full-index", :artifice => "compact_index", :all => bundle_update_requires_all?
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb
index ffe572d208..60202d1658 100644
--- a/spec/install/gems/dependency_api_spec.rb
+++ b/spec/install/gems/dependency_api_spec.rb
@@ -238,7 +238,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
- bundle "update --full-index", :artifice => "endpoint"
+ bundle! "update --full-index", :artifice => "endpoint", :all => bundle_update_requires_all?
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb
index e80385980e..b7cef0b53e 100644
--- a/spec/install/gems/flex_spec.rb
+++ b/spec/install/gems/flex_spec.rb
@@ -193,8 +193,6 @@ RSpec.describe "bundle flex_install" do
it "suggests bundle update when the Gemfile requires different versions than the lock" do
nice_error = <<-E.strip.gsub(/^ {8}/, "")
- Fetching source index from file:#{gem_repo2}/
- Resolving dependencies...
Bundler could not find compatible versions for gem "rack":
In snapshot (Gemfile.lock):
rack (= 0.9.1)
@@ -211,7 +209,7 @@ RSpec.describe "bundle flex_install" do
E
bundle :install, :retry => 0
- expect(out).to eq(nice_error)
+ expect(last_command.bundler_err).to end_with(nice_error)
end
end
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 1ba54f999e..261286f7e4 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -140,9 +140,6 @@ 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
- Fetching gem metadata from http://localgemserver.test/.
- Fetching version metadata from http://localgemserver.test/
- Resolving dependencies...
Bundler could not find compatible versions for gem "ruby\0":
In Gemfile:
ruby\0 (#{error_message_requirement})
@@ -152,7 +149,7 @@ RSpec.describe "bundle install with install-time dependencies" do
Could not find gem 'ruby\0 (> 9000)', which is required by gem 'require_ruby', in any of the sources.
E
- expect(out).to eq(nice_error)
+ expect(last_command.bundler_err).to end_with(nice_error)
end
end
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index 75d70747da..693289c72c 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "bundle install" do
gem "foo", :git => "#{lib_path("foo")}"
G
- bundle :install
+ bundle! :install
expect(out).to include("Using foo 1.0 from #{lib_path("foo")} (at master@#{revision_for(lib_path("foo"))[0..6]})")
expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}"
end
@@ -31,7 +31,7 @@ RSpec.describe "bundle install" do
update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true
- bundle! :update
+ bundle! :update, :all => bundle_update_requires_all?
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/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 113e0cdf64..149372472d 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -74,6 +74,8 @@ RSpec.describe "the lockfile format" do
end
it "does not update the lockfile's bundler version if nothing changed during bundle install" do
+ version = "#{Bundler::VERSION.split(".").first}.0.0.0.a"
+
lockfile <<-L
GEM
remote: file:#{gem_repo1}/
@@ -87,7 +89,7 @@ RSpec.describe "the lockfile format" do
rack
BUNDLED WITH
- 1.10.0
+ #{version}
L
install_gemfile <<-G
@@ -109,7 +111,7 @@ RSpec.describe "the lockfile format" do
rack
BUNDLED WITH
- 1.10.0
+ #{version}
G
end
@@ -1304,7 +1306,7 @@ RSpec.describe "the lockfile format" do
it "preserves Gemfile.lock \\n line endings" do
update_repo2
- expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) }
+ expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
expect(File.read(bundled_app("Gemfile.lock"))).not_to match("\r\n")
expect(the_bundle).to include_gems "rack 1.2"
end
@@ -1315,7 +1317,7 @@ RSpec.describe "the lockfile format" do
File.open(bundled_app("Gemfile.lock"), "wb") {|f| f.puts(win_lock) }
set_lockfile_mtime_to_known_value
- expect { bundle "update" }.to change { File.mtime(bundled_app("Gemfile.lock")) }
+ expect { bundle "update", :all => true }.to change { File.mtime(bundled_app("Gemfile.lock")) }
expect(File.read(bundled_app("Gemfile.lock"))).to match("\r\n")
expect(the_bundle).to include_gems "rack 1.2"
end
@@ -1369,12 +1371,12 @@ RSpec.describe "the lockfile format" do
#{Bundler::VERSION}
L
- error = install_gemfile(<<-G)
+ install_gemfile(<<-G)
source "file://#{gem_repo1}"
gem "rack"
G
- expect(error).to match(/your Gemfile.lock contains merge conflicts/i)
- expect(error).to match(/git checkout HEAD -- Gemfile.lock/i)
+ expect(last_command.bundler_err).to match(/your Gemfile.lock contains merge conflicts/i)
+ expect(last_command.bundler_err).to match(/git checkout HEAD -- Gemfile.lock/i)
end
end
diff --git a/spec/update/gems/post_install_spec.rb b/spec/update/gems/post_install_spec.rb
index b9cbead53f..2fb3547806 100644
--- a/spec/update/gems/post_install_spec.rb
+++ b/spec/update/gems/post_install_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe "bundle update" do
gem 'thin'
G
- bundle! :update
+ bundle! :update, :all => bundle_update_requires_all?
end
it_behaves_like "a post-install message outputter"
@@ -67,7 +67,7 @@ RSpec.describe "bundle update" do
gem 'thin'
G
- bundle! :update
+ bundle! :update, :all => bundle_update_requires_all?
end
it_behaves_like "a post-install message outputter"
diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb
index fedd1b6e7e..c04e3c68b0 100644
--- a/spec/update/git_spec.rb
+++ b/spec/update/git_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "bundle update" do
s.write "lib/foo.rb", "FOO = '1.1'"
end
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(the_bundle).to include_gems "foo 1.1"
end
@@ -112,7 +112,7 @@ RSpec.describe "bundle update" do
gem 'foo', :git => "#{@remote.path}", :tag => "fubar"
G
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(exitstatus).to eq(0) if exitstatus
end
@@ -186,8 +186,9 @@ RSpec.describe "bundle update" do
lib_path("foo-1.0").join(".git").rmtree
- bundle :update
- expect(out).to include(lib_path("foo-1.0").to_s)
+ bundle :update, :all => bundle_update_requires_all?
+ expect(last_command.bundler_err).to include(lib_path("foo-1.0").to_s).
+ and match(/Git error: command `git fetch.+has failed/)
end
it "should not explode on invalid revision on update of gem by name" do
@@ -227,7 +228,7 @@ RSpec.describe "bundle update" do
rails!
G
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(out).to include("Using rails 3.0 (was 2.3.2) from #{lib_path("rails")} (at master@#{revision_for(lib_path("rails"))[0..6]})")
end
end