Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Always pass the --all flag when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Mar 30, 2019
1 parent 52e329f commit 0bc4970
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 54 deletions.
2 changes: 1 addition & 1 deletion spec/cache/gems_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@

it "adds and removes when gems are updated" do
update_repo2
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(cached_gem("rack-1.2")).to exist
expect(cached_gem("rack-1.0.0")).not_to exist
end
Expand Down
2 changes: 1 addition & 1 deletion spec/cache/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
ref = git.ref_for("master", 11)
expect(ref).not_to eq(old_ref)

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true
bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)

expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
Expand Down
2 changes: 1 addition & 1 deletion spec/cache/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
end

it "ensures that a successful bundle update does not delete gems for other platforms" do
bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true

expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist
Expand Down
8 changes: 4 additions & 4 deletions spec/commands/clean_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def should_not_have_gems(*gems)
update_git "foo", :path => lib_path("foo-bar")
revision2 = revision_for(lib_path("foo-bar"))

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true
bundle! :clean

expect(out).to include("Removing foo-bar (#{revision[0..11]})")
Expand Down Expand Up @@ -378,7 +378,7 @@ def should_not_have_gems(*gems)
build_gem "foo", "1.0.1"
end

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true

should_have_gems "foo-1.0.1"
should_not_have_gems "foo-1.0"
Expand Down Expand Up @@ -441,7 +441,7 @@ def should_not_have_gems(*gems)
build_gem "foo", "1.0.1"
end

bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
should_have_gems "foo-1.0", "foo-1.0.1"
end

Expand All @@ -460,7 +460,7 @@ def should_not_have_gems(*gems)
update_repo2 do
build_gem "foo", "1.0.1"
end
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true

gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
sys_exec! "#{gem} list"
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
D

bundle! "package --no-install"
bundle! "update"
bundle! "update --all"

expect(the_bundle).to include_gems "rack 1.0.0"
end
Expand Down
28 changes: 14 additions & 14 deletions spec/commands/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
gem "rack", "1.0"
G

bundle! "update --gemfile OmgFile", :all => bundle_update_requires_all?
bundle! "update --gemfile OmgFile", :all => true

expect(bundled_app("OmgFile.lock")).to exist
end
Expand Down Expand Up @@ -167,7 +167,7 @@
end
end

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true

expect(the_bundle).to include_gems("slim 3.0.9", "slim-rails 3.1.3", "slim_lint 0.16.1")
end
Expand Down Expand Up @@ -282,7 +282,7 @@
describe "in a frozen bundle" do
it "should fail loudly", :bundler => "< 2" do
bundle! "install --deployment"
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true

expect(last_command).to be_failure
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m)
Expand All @@ -291,14 +291,14 @@

it "should suggest different command when frozen is set globally", :bundler => "< 2" do
bundle! "config set --global frozen 1"
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(out).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
and match(/freeze \nby running `bundle config unset frozen`./m)
end

it "should suggest different command when frozen is set globally", :bundler => "2" do
bundle! "config set --global deployment true"
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m).
and match(/freeze \nby running `bundle config unset deployment`./m)
end
Expand Down Expand Up @@ -542,7 +542,7 @@
gem "rack", "1.0"
G

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true

expect(the_bundle).to include_gems "rack 1.0.0"
end
Expand All @@ -563,7 +563,7 @@
end

it "should explain that bundler conflicted", :bundler => "< 2" do
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
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)
Expand All @@ -586,14 +586,14 @@
gem "activesupport"
G

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(out).to include("Using activesupport 2.3.5")

update_repo2 do
build_gem "activesupport", "3.0"
end

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(out).to include("Installing activesupport 3.0 (was 2.3.5)")
end

Expand All @@ -612,15 +612,15 @@
gem "foo"
G

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true
out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "")
expect(out).to include "Resolving dependencies...\nBundle updated!"

update_repo4 do
build_gem "foo", "2.0"
end

bundle! "update", :all => bundle_update_requires_all?
bundle! "update", :all => true
out.sub!("Removing foo (1.0)\n", "")
out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "")
expect(out).to include strip_whitespace(<<-EOS).strip
Expand Down Expand Up @@ -826,7 +826,7 @@
end

it "update all" do
bundle! "update --patch", :all => bundle_update_requires_all?
bundle! "update --patch", :all => true

expect(the_bundle).to include_gems "foo 1.4.5", "bar 2.1.1", "qux 1.0.1"
end
Expand All @@ -848,7 +848,7 @@
end

it "minor preferred" do
bundle! "update --minor --strict", :all => bundle_update_requires_all?
bundle! "update --minor --strict", :all => true

expect(the_bundle).to include_gems "foo 1.5.0", "bar 2.1.1", "qux 1.1.0"
end
Expand Down Expand Up @@ -945,7 +945,7 @@
end

it "raises if too many flags are provided" do
bundle "update --patch --minor", :all => bundle_update_requires_all?
bundle "update --patch --minor", :all => true

expect(last_command.bundler_err).to eq "Provide only one of the following options: minor, patch"
end
Expand Down
8 changes: 4 additions & 4 deletions spec/install/gemfile/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
G

# ensure we also git fetch after cloning
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true

Dir.chdir(Dir[home(".bundle/cache/git/foo-*")].first) do
sys_exec("git ls-remote .")
Expand Down Expand Up @@ -814,14 +814,14 @@
s.write "lib/forced.rb", "FORCED = '1.1'"
end

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.1"

Dir.chdir(lib_path("forced-1.0")) do
`git reset --hard HEAD^`
end

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(the_bundle).to include_gems "forced 1.0"
end

Expand Down Expand Up @@ -1378,7 +1378,7 @@
G

with_path_as("") do
bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
end
expect(last_command.bundler_err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
Expand Down
2 changes: 1 addition & 1 deletion spec/install/gems/compact_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def require(*args)
gem "rack"
G

bundle! "update --full-index", :artifice => "compact_index", :all => bundle_update_requires_all?
bundle! "update --full-index", :artifice => "compact_index", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/install/gems/dependency_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def require(*args)
gem "rack"
G

bundle! "update --full-index", :artifice => "endpoint", :all => bundle_update_requires_all?
bundle! "update --full-index", :artifice => "endpoint", :all => true
expect(out).to include("Fetching source index from #{source_uri}")
expect(the_bundle).to include_gems "rack 1.0.0"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/install/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

update_git "foo", "4.0", :path => lib_path("foo"), :gemspec => true

bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
expect(out).to include("Using foo 2.0 (was 1.0) from #{lib_path("foo")} (at master~2@#{rev2})")
expect(the_bundle).to include_gems "foo 2.0", :source => "git@#{lib_path("foo")}"
end
Expand Down
8 changes: 4 additions & 4 deletions spec/install/post_bundle_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,28 @@

describe "for bundle update" do
it "without any options" do
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
expect(out).not_to include("Gems in the groups")
expect(out).to include(bundle_updated_message)
end

it "with --without one group" do
bundle! :install, forgotten_command_line_options(:without => "emo")
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
expect(out).to include("Gems in the group emo were not installed")
expect(out).to include(bundle_updated_message)
end

it "with --without two groups" do
bundle! :install, forgotten_command_line_options(:without => "emo test")
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
expect(out).to include("Gems in the groups emo and test were not installed")
expect(out).to include(bundle_updated_message)
end

it "with --without more groups" do
bundle! :install, forgotten_command_line_options(:without => "emo obama test")
bundle! :update, :all => bundle_update_requires_all?
bundle! :update, :all => true
expect(out).to include("Gems in the groups emo, obama and test were not installed")
expect(out).to include(bundle_updated_message)
end
Expand Down
12 changes: 6 additions & 6 deletions spec/other/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end

Expand All @@ -528,7 +528,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle "update", :all => bundle_update_requires_all?
bundle "update", :all => true
expect(the_bundle).to include_gems "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
end
end
Expand All @@ -545,7 +545,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle :update, :all => bundle_update_requires_all?
bundle :update, :all => true
should_be_ruby_version_incorrect
end

Expand All @@ -561,7 +561,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle :update, :all => bundle_update_requires_all?
bundle :update, :all => true
should_be_engine_incorrect
end

Expand All @@ -578,7 +578,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle :update, :all => bundle_update_requires_all?
bundle :update, :all => true
should_be_engine_version_incorrect
end
end
Expand All @@ -594,7 +594,7 @@ def should_be_patchlevel_fixnum
build_gem "activesupport", "3.0"
end

bundle :update, :all => bundle_update_requires_all?
bundle :update, :all => true
should_be_patchlevel_incorrect
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/realworld/parallel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
gem 'i18n', '~> 0.6.0' # Because 0.7+ requires Ruby 1.9.3+
G

bundle :update, :jobs => 4, :env => { "DEBUG" => "1" }, :all => bundle_update_requires_all?
bundle :update, :jobs => 4, :env => { "DEBUG" => "1" }, :all => true

expect(out).to match(/[1-3]: /)

Expand Down
4 changes: 0 additions & 4 deletions spec/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ def exitstatus
last_command.exitstatus
end

def bundle_update_requires_all?
Bundler::VERSION.start_with?("1.") ? nil : true
end

def in_app_root(&blk)
Dir.chdir(bundled_app, &blk)
end
Expand Down
Loading

0 comments on commit 0bc4970

Please sign in to comment.