From c425c5cd2b987a5b4c2c397b5308618241dcacbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 27 Feb 2019 09:52:15 +0100 Subject: Prefer the `err` helper for checking errors The helper already considers the stream errors are printed to. --- spec/install/gemfile/sources_spec.rb | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb index b29346c800..96aa5a1803 100644 --- a/spec/install/gemfile/sources_spec.rb +++ b/spec/install/gemfile/sources_spec.rb @@ -30,9 +30,9 @@ RSpec.describe "bundle install with gems on multiple sources" do it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 2" do bundle :install - expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") - expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") - expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}")) + expect(err).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") + expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}")) expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") end @@ -59,9 +59,9 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "warns about ambiguous gems, but installs anyway", :bundler => "< 2" do - expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") - expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") - expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}")) + expect(err).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") + expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo1}")) expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1") end end @@ -249,9 +249,9 @@ RSpec.describe "bundle install with gems on multiple sources" do end it "installs from the other source and warns about ambiguous gems", :bundler => "< 2" do - expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") - expect(out).to include("Warning: the gem 'rack' was found in multiple sources.") - expect(out).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}")) + expect(err).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") + expect(err).to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).to include(normalize_uri_file("Installed from: file://localhost#{gem_repo2}")) expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -277,7 +277,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs the dependency from the pinned source without warning", :bundler => "< 2" do bundle :install - expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") # In https://github.com/bundler/bundler/issues/3585 this failed @@ -285,7 +285,7 @@ RSpec.describe "bundle install with gems on multiple sources" do system_gems [] bundle :install - expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") + expect(err).not_to include("Warning: the gem 'rack' was found in multiple sources.") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0") end end @@ -330,7 +330,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs all gems without warning" do bundle :install - expect(out).not_to include("Warning") + expect(err).not_to include("Warning") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") end end @@ -365,7 +365,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs the dependency from the top-level source without warning" do bundle :install - expect(out).not_to include("Warning") + expect(err).not_to include("Warning") expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0", "unrelated_gem 1.0.0") end end @@ -454,7 +454,7 @@ RSpec.describe "bundle install with gems on multiple sources" do it "installs the gems without any warning" do bundle :install - expect(out).not_to include("Warning") + expect(err).not_to include("Warning") expect(the_bundle).to include_gems("rack 1.0.0") end end @@ -632,7 +632,7 @@ RSpec.describe "bundle install with gems on multiple sources" do gem "depends_on_rack" G expect(last_command).to be_failure - expect(last_command.stderr).to eq normalize_uri_file(strip_whitespace(<<-EOS).strip) + expect(err).to eq normalize_uri_file(strip_whitespace(<<-EOS).strip) The gem 'rack' was found in multiple relevant sources. * rubygems repository file://localhost#{gem_repo1}/ or installed locally * rubygems repository file://localhost#{gem_repo4}/ or installed locally -- cgit v1.2.1