From 762227012e61e45af9241019732cf8036305171d Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Sun, 2 Jul 2017 15:33:38 +0200 Subject: Update the Bundler 2 specs for the removal of using... messages --- lib/bundler/source/metadata.rb | 2 +- spec/commands/pristine_spec.rb | 9 +++------ spec/commands/update_spec.rb | 6 +++--- spec/install/deploy_spec.rb | 4 +--- spec/install/force_spec.rb | 6 ------ spec/install/gemfile/eval_gemfile_spec.rb | 6 ++++-- spec/install/gemfile/git_spec.rb | 5 ++--- spec/install/gems/native_extensions_spec.rb | 1 - spec/install/git_spec.rb | 4 ++-- spec/runtime/setup_spec.rb | 9 +++------ spec/update/git_spec.rb | 5 ++--- 11 files changed, 21 insertions(+), 36 deletions(-) diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb index f6d2f0729d..1d62a1f76a 100644 --- a/lib/bundler/source/metadata.rb +++ b/lib/bundler/source/metadata.rb @@ -36,7 +36,7 @@ module Bundler end def install(spec, _opts = {}) - Bundler.ui.info "Using #{version_message(spec)}" + print_using_message "Using #{version_message(spec)}" nil end diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb index 9c3918f51e..5f8a230aef 100644 --- a/spec/commands/pristine_spec.rb +++ b/spec/commands/pristine_spec.rb @@ -116,7 +116,6 @@ RSpec.describe "bundle pristine" do foo_changes_txt = Pathname.new(foo.full_gem_path).join("lib/changes.txt") FileUtils.touch(foo_changes_txt) expect(foo_changes_txt).to be_file - foo_ref = Spec::Builders::GitReader.new(lib_path("foo")).ref_for("HEAD", 6) bar = Bundler.definition.specs["bar"].first bar_changes_txt = Pathname.new(bar.full_gem_path).join("lib/changes.txt") @@ -130,11 +129,9 @@ RSpec.describe "bundle pristine" do bundle! "pristine foo bar weakling" - expect(out).to eq(strip_whitespace(<<-EOS).strip) - Cannot pristine bar (1.0). Gem is sourced from local path. - Using foo 1.0 from #{lib_path("foo")} (at master@#{foo_ref}) - Installing weakling 1.0 - EOS + expect(out).to include("Cannot pristine bar (1.0). Gem is sourced from local path."). + and include("Installing weakling 1.0") + expect(weakling_changes_txt).not_to be_file expect(foo_changes_txt).not_to be_file expect(bar_changes_txt).to be_file diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb index 70ced672dd..eb6d2382cf 100644 --- a/spec/commands/update_spec.rb +++ b/spec/commands/update_spec.rb @@ -430,7 +430,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end RSpec.describe "bundle update" do - it "shows the previous version of the gem when updated from rubygems source" do + it "shows the previous version of the gem when updated from rubygems source", :bundler => "< 2" do build_repo2 install_gemfile <<-G @@ -464,7 +464,7 @@ RSpec.describe "bundle update" do gem "foo" G - bundle! "update" + bundle! "update", :all => bundle_update_requires_all? out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "") expect(out).to include "Resolving dependencies...\nBundle updated!" @@ -472,7 +472,7 @@ RSpec.describe "bundle update" do build_gem "foo", "2.0" end - bundle! "update" + bundle! "update", :all => bundle_update_requires_all? out.gsub!(/RubyGems [\d\.]+ is not threadsafe.*\n?/, "") expect(out).to include strip_whitespace(<<-EOS).strip Resolving dependencies... diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb index 8ef948de77..b4ab5d495f 100644 --- a/spec/install/deploy_spec.rb +++ b/spec/install/deploy_spec.rb @@ -312,15 +312,13 @@ You have deleted from the Gemfile: expect(bundled_app("vendor/cache/foo")).to be_directory bundle! "install --local" - expect(out).to include("Using foo 1.0 from source at") - expect(out).to include("vendor/cache/foo") + expect(out).to include("Updating files in vendor/cache") simulate_new_machine bundle! "install --deployment --verbose" expect(out).not_to include("You are trying to install in deployment mode after changing your Gemfile") expect(out).not_to include("You have added to the Gemfile") expect(out).not_to include("You have deleted from the Gemfile") - expect(out).to include("Using foo 1.0 from source at") expect(out).to include("vendor/cache/foo") expect(the_bundle).to include_gems "foo 1.0" end diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb index 2bc300597d..5592e62d68 100644 --- a/spec/install/force_spec.rb +++ b/spec/install/force_spec.rb @@ -17,7 +17,6 @@ RSpec.describe "bundle install" do bundle "install --force" expect(exitstatus).to eq(0) if exitstatus - expect(out).to include "Using bundler" expect(out).to include "Installing rack 1.0.0" expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n") expect(the_bundle).to include_gems "rack 1.0.0" @@ -27,7 +26,6 @@ RSpec.describe "bundle install" do bundle "install --force" expect(exitstatus).to eq(0) if exitstatus - expect(out).to include "Using bundler" expect(out).to include "Installing rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0" end @@ -48,8 +46,6 @@ RSpec.describe "bundle install" do foo_lib.open("w") {|f| f.write("blah blah blah") } bundle! "install --force" - expect(out).to include "Using bundler" - expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n") expect(the_bundle).to include_gems "foo 1.0" end @@ -57,8 +53,6 @@ RSpec.describe "bundle install" do it "works on first bundle install" do bundle! "install --force" - expect(out).to include "Using bundler" - expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" expect(the_bundle).to include_gems "foo 1.0" end end diff --git a/spec/install/gemfile/eval_gemfile_spec.rb b/spec/install/gemfile/eval_gemfile_spec.rb index f3f9cb6444..b76fae02dc 100644 --- a/spec/install/gemfile/eval_gemfile_spec.rb +++ b/spec/install/gemfile/eval_gemfile_spec.rb @@ -20,8 +20,9 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do eval_gemfile 'Gemfile-other' G expect(out).to include("Resolving dependencies") - expect(out).to include("Using gunks 0.0.1 from source at `gems/gunks`") expect(out).to include("Bundle complete") + + expect(the_bundle).to include_gem "gunks 0.0.1", :source => "path@#{bundled_app("gems", "gunks")}" end end @@ -52,8 +53,9 @@ RSpec.describe "bundle install with gemfile that uses eval_gemfile" do gemspec :path => 'gems/gunks' G expect(out).to include("Resolving dependencies") - expect(out).to include("Using gunks 0.0.1 from source at `gems/gunks`") expect(out).to include("Bundle complete") + + expect(the_bundle).to include_gem "gunks 0.0.1", :source => "path@#{bundled_app("gems", "gunks")}" end end end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index c160170a7a..b3fc38ec24 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -397,9 +397,8 @@ RSpec.describe "bundle install with git sources" do gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "master" G - bundle %(config local.rack #{lib_path("local-rack")}) - bundle :install - expect(out).to match(/at #{lib_path('local-rack')}/) + bundle! %(config local.rack #{lib_path("local-rack")}) + bundle! :install run "require 'rack'" expect(out).to eq("LOCAL") diff --git a/spec/install/gems/native_extensions_spec.rb b/spec/install/gems/native_extensions_spec.rb index f27e0b10d5..c8252b81f1 100644 --- a/spec/install/gems/native_extensions_spec.rb +++ b/spec/install/gems/native_extensions_spec.rb @@ -83,7 +83,6 @@ RSpec.describe "installing a gem with native extensions" do G expect(out).not_to include("extconf.rb failed") - expect(out).to include("Using c_extension 1.0") run! "Bundler.require; puts CExtension.new.its_true" expect(out).to eq("true") diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 693289c72c..85523b350e 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -2,7 +2,7 @@ RSpec.describe "bundle install" do context "git sources" do - it "displays the revision hash of the gem repository" do + it "displays the revision hash of the gem repository", :bundler => "< 2" do build_git "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -14,7 +14,7 @@ RSpec.describe "bundle install" do expect(the_bundle).to include_gems "foo 1.0", :source => "git@#{lib_path("foo")}" end - it "displays the ref of the gem repository when using branch~num as a ref" do + it "displays the ref of the gem repository when using branch~num as a ref", :bundler => "< 2" do build_git "foo", "1.0", :path => lib_path("foo") rev = revision_for(lib_path("foo"))[0..6] update_git "foo", "2.0", :path => lib_path("foo"), :gemspec => true diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 9f00f9a06b..5fcbd4eb45 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -529,8 +529,7 @@ RSpec.describe "Bundler.setup" do G bundle %(config local.rack #{lib_path("local-rack")}) - bundle :install - expect(out).to match(/at #{lib_path('local-rack')}/) + bundle! :install FileUtils.rm_rf(lib_path("local-rack")) run "require 'rack'" @@ -548,8 +547,7 @@ RSpec.describe "Bundler.setup" do G bundle %(config local.rack #{lib_path("local-rack")}) - bundle :install - expect(out).to match(/at #{lib_path('local-rack')}/) + bundle! :install gemfile <<-G source "file://#{gem_repo1}" @@ -571,8 +569,7 @@ RSpec.describe "Bundler.setup" do G bundle %(config local.rack #{lib_path("local-rack")}) - bundle :install - expect(out).to match(/at #{lib_path('local-rack')}/) + bundle! :install gemfile <<-G source "file://#{gem_repo1}" diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index f7e10de666..2b12713198 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -27,12 +27,11 @@ RSpec.describe "bundle update" do s.add_dependency "activesupport", "= 3.0" end - install_gemfile <<-G + install_gemfile! <<-G gem "rails", :git => "#{lib_path("rails")}" G - bundle "update rails" - expect(out).to include("Using activesupport 3.0 from #{lib_path("rails")} (at master@#{revision_for(lib_path("rails"))[0..6]})") + bundle! "update rails" expect(the_bundle).to include_gems "rails 3.0", "activesupport 3.0" end -- cgit v1.2.1