From de775593ffc43e97e3d5adec3837a1eee4c3b74b Mon Sep 17 00:00:00 2001 From: Samuel Giddins Date: Wed, 21 Jun 2017 13:33:52 -0500 Subject: Get the specs passing in 1.0 mode --- spec/bundler/cli_spec.rb | 2 +- spec/bundler/friendly_errors_spec.rb | 2 +- spec/cache/git_spec.rb | 8 ++++---- spec/commands/exec_spec.rb | 10 +++++----- spec/commands/package_spec.rb | 6 +++--- spec/install/gems/compact_index_spec.rb | 2 +- spec/install/gems/standalone_spec.rb | 14 +++++++------- spec/other/cli_dispatch_spec.rb | 8 ++++---- spec/other/major_deprecation_spec.rb | 8 ++++---- spec/support/helpers.rb | 2 +- spec/support/matchers.rb | 12 ++++++------ 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 070d5992dc..5519b9bbb1 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -69,7 +69,7 @@ RSpec.describe "bundle executable" do describe "printing the outdated warning" do shared_examples_for "no warning" do it "prints no warning" do - bundle! "fail" + bundle "fail" expect(last_command.stdboth).to eq("Could not find command \"fail\".") end end diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb index d27a4fc2c4..c5ea3ba52f 100644 --- a/spec/bundler/friendly_errors_spec.rb +++ b/spec/bundler/friendly_errors_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Bundler, "friendly errors" do bundle :install, :env => { "DEBUG" => true } - expect(err).to include("Failed to load #{home(".gemrc")}") + expect(last_command.stderr).to include("Failed to load #{home(".gemrc")}") expect(exitstatus).to eq(0) if exitstatus end end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 59eaa51679..8f12028ffc 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -52,14 +52,14 @@ end it "runs twice without exploding" do build_git "foo" - install_gemfile <<-G + install_gemfile! <<-G gem "foo", :git => '#{lib_path("foo-1.0")}' G - bundle "#{cmd} --all" - bundle "#{cmd} --all" + bundle! "#{cmd} --all" + bundle! "#{cmd} --all" - expect(err).to lack_errors + expect(last_command.stdout).to include "Updating files in vendor/cache" FileUtils.rm_rf lib_path("foo-1.0") expect(the_bundle).to include_gems "foo 1.0" end diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 7b0da1694c..1d9e5f2ed5 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -225,7 +225,7 @@ RSpec.describe "bundle exec" do [true, false].each do |l| bundle! "config disable_exec_load #{l}" bundle "exec rackup" - expect(err).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" + expect(last_command.stderr).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" end end @@ -239,7 +239,7 @@ RSpec.describe "bundle exec" do [true, false].each do |l| bundle! "config disable_exec_load #{l}" bundle "exec rackup" - expect(err).to include "rack is not part of the bundle. Add it to your Gemfile." + expect(last_command.stderr).to include "rack is not part of the bundle. Add it to your Gemfile." end end @@ -519,8 +519,8 @@ RSpec.describe "bundle exec" do it "like a normally executed executable" do subject expect(exitstatus).to eq(exit_code) if exitstatus - expect(err).to eq(expected_err) - expect(out).to eq(expected) + expect(last_command.stderr).to eq(expected_err) + expect(last_command.stdout).to eq(expected) end end @@ -730,7 +730,7 @@ __FILE__: #{path.to_s.inspect} # sanity check that we get the newer, custom version without bundler sys_exec("#{Gem.ruby} #{file}") - expect(err).to include("custom openssl should not be loaded") + expect(last_command.stderr).to include("custom openssl should not be loaded") end end end diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb index 5ecc215b59..9b0de7f4e4 100644 --- a/spec/commands/package_spec.rb +++ b/spec/commands/package_spec.rb @@ -162,7 +162,7 @@ RSpec.describe "bundle package" do gem 'rack' D - bundle "package --no-install" + bundle! "package --no-install" expect(the_bundle).not_to include_gems "rack 1.0.0" expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist @@ -174,8 +174,8 @@ RSpec.describe "bundle package" do gem 'rack' D - bundle "package --no-install" - bundle "install" + bundle! "package --no-install" + bundle! "install" expect(the_bundle).to include_gems "rack 1.0.0" end diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index 6ff1180a37..c42816a3fb 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -60,7 +60,7 @@ RSpec.describe "compact index api" do # can't use `include_gems` here since the `require` will conflict on a # case-insensitive FS run! "Bundler.require; puts Gem.loaded_specs.values_at('rack', 'Rack').map(&:full_name)" - expect(out).to eq("rack-1.0\nRack-0.1") + expect(last_command.stdout).to eq("rack-1.0\nRack-0.1") end it "should handle multiple gem dependencies on the same gem" do diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 58fac1213a..8899272393 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -171,8 +171,8 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(out).to eq("2.3.2") - expect(err).to eq("ZOMG LOAD ERROR") + expect(last_command.stdout).to eq("2.3.2") + expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end it "allows --without to limit the groups used in a standalone" do @@ -189,8 +189,8 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(out).to eq("2.3.2") - expect(err).to eq("ZOMG LOAD ERROR") + expect(last_command.stdout).to eq("2.3.2") + expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end it "allows --path to change the location of the standalone bundle" do @@ -206,7 +206,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(out).to eq("2.3.2") + expect(last_command.stdout).to eq("2.3.2") end it "allows remembered --without to limit the groups used in a standalone" do @@ -224,8 +224,8 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(out).to eq("2.3.2") - expect(err).to eq("ZOMG LOAD ERROR") + expect(last_command.stdout).to eq("2.3.2") + expect(last_command.stderr).to eq("ZOMG LOAD ERROR") end end diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb index 12f5a3ea1a..05d313ef2b 100644 --- a/spec/other/cli_dispatch_spec.rb +++ b/spec/other/cli_dispatch_spec.rb @@ -3,14 +3,14 @@ RSpec.describe "bundle command names" do it "work when given fully" do bundle "install" - expect(err).to eq("Could not locate Gemfile") - expect(out).not_to include("Ambiguous command") + expect(last_command.bundler_err).to eq("Could not locate Gemfile") + expect(last_command.stdboth).not_to include("Ambiguous command") end it "work when not ambiguous" do bundle "ins" - expect(err).to eq("Could not locate Gemfile") - expect(out).not_to include("Ambiguous command") + expect(last_command.bundler_err).to eq("Could not locate Gemfile") + expect(last_command.stdboth).not_to include("Ambiguous command") end it "print a friendly error when ambiguous" do diff --git a/spec/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb index e2d570ca44..d79a9b6392 100644 --- a/spec/other/major_deprecation_spec.rb +++ b/spec/other/major_deprecation_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "major deprecations", :bundler => "< 2" do describe "bundle_ruby" do it "prints a deprecation" do bundle_ruby - out.gsub! "\nruby #{RUBY_VERSION}", "" + warnings.gsub! "\nruby #{RUBY_VERSION}", "" expect(warnings).to have_major_deprecation "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`" end end @@ -255,14 +255,14 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add context "bundle list" do it "prints a deprecation warning" do - install_gemfile <<-G + install_gemfile! <<-G source "file://#{gem_repo1}" gem "rack" G - bundle :list + bundle! :list - out.gsub!(/gems included.*?\[DEPRECATED/im, "[DEPRECATED") + warnings.gsub!(/gems included.*?\[DEPRECATED/im, "[DEPRECATED") expect(warnings).to have_major_deprecation("use `bundle show` instead of `bundle list`") end diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 3e53068dee..b31b0f05c1 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -42,7 +42,7 @@ module Spec end def err - last_command.bundler_err + last_command.stderr end def exitstatus diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 4fbf44a4e0..e91f04fb29 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -140,8 +140,8 @@ module Spec rescue => e next "#{name} is not installed:\n#{indent(e)}" end - out.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") - actual_version, actual_platform = out.strip.split(/\s+/, 2) + last_command.stdout.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") + actual_version, actual_platform = last_command.stdout.strip.split(/\s+/, 2) unless Gem::Version.new(actual_version) == Gem::Version.new(version) next "#{name} was expected to be at version #{version} but was #{actual_version}" end @@ -155,8 +155,8 @@ module Spec rescue next "#{name} does not have a source defined:\n#{indent(e)}" end - out.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") - unless out.strip == source + last_command.stdout.gsub!(/#{MAJOR_DEPRECATION}.*$/, "") + unless last_command.stdout.strip == source next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`" end end.compact @@ -181,9 +181,9 @@ module Spec rescue => e next "checking for #{name} failed:\n#{e}" end - next if out == "WIN" + next if last_command.stdout == "WIN" next "expected #{name} to not be installed, but it was" if version.nil? - if Gem::Version.new(out) == Gem::Version.new(version) + if Gem::Version.new(last_command.stdout) == Gem::Version.new(version) next "expected #{name} (#{version}) not to be installed, but it was" end end.compact -- cgit v1.2.1