From c494e1261268a5249b6406fe35709016f7c4c3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 12 Apr 2019 10:48:05 +0200 Subject: s/last_command.stdout/out/ --- spec/bundler/cli_spec.rb | 8 ++++---- spec/cache/git_spec.rb | 2 +- spec/commands/binstubs_spec.rb | 2 +- spec/commands/config_spec.rb | 34 ++++++++++++++++----------------- spec/commands/exec_spec.rb | 2 +- spec/commands/newgem_spec.rb | 2 +- spec/install/gemfile/git_spec.rb | 4 ++-- spec/install/gems/compact_index_spec.rb | 2 +- spec/install/gems/standalone_spec.rb | 10 +++++----- spec/other/cli_dispatch_spec.rb | 2 +- spec/realworld/mirror_probe_spec.rb | 2 +- spec/runtime/gem_tasks_spec.rb | 2 +- spec/runtime/inline_spec.rb | 2 +- spec/runtime/setup_spec.rb | 6 +++--- spec/support/matchers.rb | 8 ++++---- 15 files changed, 44 insertions(+), 44 deletions(-) diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 9b3f9a7129..2e12fbfc6b 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -31,7 +31,7 @@ RSpec.describe "bundle executable" do it "prints a concise help message", :bundler => "3" do bundle! "" expect(err).to be_empty - expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}"). + expect(out).to include("Bundler version #{Bundler::VERSION}"). and include("\n\nBundler commands:\n\n"). and include("\n\n Primary commands:\n"). and include("\n\n Utilities:\n"). @@ -72,17 +72,17 @@ RSpec.describe "bundle executable" do it "prints the running command" do gemfile "" bundle! "info bundler", :verbose => true - expect(last_command.stdout).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}") + expect(out).to start_with("Running `bundle info bundler --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do install_gemfile! "", :verbose => true - expect(last_command.stdout).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}") + expect(out).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}") end it "doesn't print defaults" do install_gemfile! "", :verbose => true - expect(last_command.stdout).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}") + expect(out).to start_with("Running `bundle install --retry 0 --verbose` with bundler #{Bundler::VERSION}") end end diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 55a24ff118..d31d607d25 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -59,7 +59,7 @@ end bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true) bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true) - expect(last_command.stdout).to include "Updating files in vendor/cache" + expect(out).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/binstubs_spec.rb b/spec/commands/binstubs_spec.rb index d2a22f3059..77f23b9a2f 100644 --- a/spec/commands/binstubs_spec.rb +++ b/spec/commands/binstubs_spec.rb @@ -173,7 +173,7 @@ RSpec.describe "bundle binstubs " do it "calls through to the latest bundler version" do sys_exec! "#{bundled_app("bin/bundle")} update --bundler" - expect(last_command.stdout).to eq %(system bundler #{system_bundler_version}\n["update", "--bundler"]) + expect(out).to eq %(system bundler #{system_bundler_version}\n["update", "--bundler"]) end it "calls through to the explicit bundler version" do diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb index 0ecd61183b..f5b3e7c998 100644 --- a/spec/commands/config_spec.rb +++ b/spec/commands/config_spec.rb @@ -391,42 +391,42 @@ E describe "subcommands" do it "list" do bundle! "config list" - expect(last_command.stdout).to eq "Settings are listed in order of priority. The top value will be used.\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\"" + expect(out).to eq "Settings are listed in order of priority. The top value will be used.\nspec_run\nSet via BUNDLE_SPEC_RUN: \"true\"" bundle! "config list", :parseable => true - expect(last_command.stdout).to eq "spec_run=true" + expect(out).to eq "spec_run=true" end it "get" do ENV["BUNDLE_BAR"] = "bar_val" bundle! "config get foo" - expect(last_command.stdout).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" + expect(out).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" ENV["BUNDLE_FOO"] = "foo_val" bundle! "config get foo --parseable" - expect(last_command.stdout).to eq "foo=foo_val" + expect(out).to eq "foo=foo_val" bundle! "config get foo" - expect(last_command.stdout).to eq "Settings for `foo` in order of priority. The top value will be used\nSet via BUNDLE_FOO: \"foo_val\"" + expect(out).to eq "Settings for `foo` in order of priority. The top value will be used\nSet via BUNDLE_FOO: \"foo_val\"" end it "set" do bundle! "config set foo 1" - expect(last_command.stdout).to eq "" + expect(out).to eq "" bundle! "config set --local foo 2" - expect(last_command.stdout).to eq "" + expect(out).to eq "" bundle! "config set --global foo 3" - expect(last_command.stdout).to eq "Your application has set foo to \"2\". This will override the global value you are currently setting" + expect(out).to eq "Your application has set foo to \"2\". This will override the global value you are currently setting" bundle! "config set --parseable --local foo 4" - expect(last_command.stdout).to eq "foo=4" + expect(out).to eq "foo=4" bundle! "config set --local foo 4.1" - expect(last_command.stdout).to eq "You are replacing the current local value of foo, which is currently \"4\"" + expect(out).to eq "You are replacing the current local value of foo, which is currently \"4\"" bundle "config set --global --local foo 5" expect(last_command).to be_failure @@ -435,37 +435,37 @@ E it "unset" do bundle! "config unset foo" - expect(last_command.stdout).to eq "" + expect(out).to eq "" bundle! "config set foo 1" bundle! "config unset foo --parseable" - expect(last_command.stdout).to eq "" + expect(out).to eq "" bundle! "config set --local foo 1" bundle! "config set --global foo 2" bundle! "config unset foo" - expect(last_command.stdout).to eq "" + expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" bundle! "config set --local foo 1" bundle! "config set --global foo 2" bundle! "config unset foo --local" - expect(last_command.stdout).to eq "" + expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for the current user (#{home(".bundle/config")}): \"2\"" bundle! "config unset foo --global" - expect(last_command.stdout).to eq "" + expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" bundle! "config set --local foo 1" bundle! "config set --global foo 2" bundle! "config unset foo --global" - expect(last_command.stdout).to eq "" + expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nSet for your local app (#{bundled_app(".bundle/config")}): \"1\"" bundle! "config unset foo --local" - expect(last_command.stdout).to eq "" + expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" bundle "config unset foo --local --global" diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 9d849f9f49..dd8b08a02a 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -586,7 +586,7 @@ RSpec.describe "bundle exec" do subject expect(exitstatus).to eq(exit_code) if exitstatus expect(err).to eq(expected_err) - expect(last_command.stdout).to eq(expected) + expect(out).to eq(expected) end end diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index 104d616d24..bb04f33c80 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -887,7 +887,7 @@ Usage: "bundle gem NAME [OPTIONS]" FileUtils.mkdir_p("conflict-foobar/Gemfile") end bundle! "gem conflict-foobar" - expect(last_command.stdout).to include("file_clash conflict-foobar/Gemfile"). + expect(out).to include("file_clash conflict-foobar/Gemfile"). and include "Initializing git repo in #{bundled_app("conflict-foobar")}" end end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 89207dc2a6..785bf4336e 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -1437,7 +1437,7 @@ In Gemfile: G expect(last_command.stdboth).to_not include("password1") - expect(last_command.stdout).to include("Fetching https://user1@github.com/company/private-repo") + expect(out).to include("Fetching https://user1@github.com/company/private-repo") end end @@ -1452,7 +1452,7 @@ In Gemfile: G 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") + expect(out).to include("Fetching https://x-oauth-basic@github.com/company/private-repo") end end end diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index b94b68dbd9..e35b630306 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(last_command.stdout).to eq("rack-1.0\nRack-0.1") + expect(out).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 2c279fe1b4..68796977a4 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -175,7 +175,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(last_command.stdout).to eq("2.3.2") + expect(out).to eq("2.3.2") expect(err).to eq("ZOMG LOAD ERROR") end @@ -193,7 +193,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(last_command.stdout).to eq("2.3.2") + expect(out).to eq("2.3.2") expect(err).to eq("ZOMG LOAD ERROR") end @@ -210,7 +210,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(last_command.stdout).to eq("2.3.2") + expect(out).to eq("2.3.2") end it "allows --path to change the location of the standalone bundle", :bundler => "3" do @@ -227,7 +227,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(last_command.stdout).to eq("2.3.2") + expect(out).to eq("2.3.2") end it "allows remembered --without to limit the groups used in a standalone" do @@ -245,7 +245,7 @@ RSpec.shared_examples "bundle install --standalone" do RUBY end - expect(last_command.stdout).to eq("2.3.2") + expect(out).to eq("2.3.2") expect(err).to eq("ZOMG LOAD ERROR") end end diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb index f848da860c..548539ac89 100644 --- a/spec/other/cli_dispatch_spec.rb +++ b/spec/other/cli_dispatch_spec.rb @@ -23,7 +23,7 @@ RSpec.describe "bundle command names" do it "dispatches `bundle cache` to the package command" do bundle "cache --verbose" - expect(last_command.stdout).to start_with "Running `bundle package --verbose`" + expect(out).to start_with "Running `bundle package --verbose`" end end end diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb index fcec5432d5..13d1afe124 100644 --- a/spec/realworld/mirror_probe_spec.rb +++ b/spec/realworld/mirror_probe_spec.rb @@ -86,7 +86,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld = bundle :install, :artifice => nil - expect(last_command.stdout).to include "Fetching source index from #{mirror}/" + expect(out).to include "Fetching source index from #{mirror}/" expect(err).to include <<-EOS.strip Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from #{mirror}/ diff --git a/spec/runtime/gem_tasks_spec.rb b/spec/runtime/gem_tasks_spec.rb index de72869dc3..459b554353 100644 --- a/spec/runtime/gem_tasks_spec.rb +++ b/spec/runtime/gem_tasks_spec.rb @@ -39,6 +39,6 @@ RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do with_gem_path_as(Spec::Path.base_system_gems.to_s) do sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect') end - expect(last_command.stdout).to eq '["pkg"]' + expect(out).to eq '["pkg"]' end end diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 4c1cc35a4a..5738c042bf 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -274,6 +274,6 @@ RSpec.describe "bundler/inline#gemfile" do puts RACK RUBY expect(last_command).to be_success - expect(last_command.stdout).to eq "1.0.0" + expect(out).to eq "1.0.0" end end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 3aba1efa6d..90c3df8661 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1260,14 +1260,14 @@ end it "activates no gems with -rbundler/setup" do install_gemfile! "" ruby! code, :env => { :RUBYOPT => activation_warning_hack_rubyopt + " -rbundler/setup" } - expect(last_command.stdout).to eq("{}") + expect(out).to eq("{}") end it "activates no gems with bundle exec" do install_gemfile! "" create_file("script.rb", code) bundle! "exec ruby ./script.rb", :env => { :RUBYOPT => activation_warning_hack_rubyopt } - expect(last_command.stdout).to eq("{}") + expect(out).to eq("{}") end it "activates no gems with bundle exec that is loaded" do @@ -1275,7 +1275,7 @@ end create_file("script.rb", "#!/usr/bin/env ruby\n\n#{code}") FileUtils.chmod(0o777, bundled_app("script.rb")) bundle! "exec ./script.rb", :artifice => nil, :env => { :RUBYOPT => activation_warning_hack_rubyopt } - expect(last_command.stdout).to eq("{}") + expect(out).to eq("{}") end let(:default_gems) do diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index f9efe32a38..5d1a6a7919 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -133,7 +133,7 @@ module Spec rescue StandardError => e next "#{name} is not installed:\n#{indent(e)}" end - actual_version, actual_platform = last_command.stdout.strip.split(/\s+/, 2) + actual_version, actual_platform = out.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 @@ -147,7 +147,7 @@ module Spec rescue StandardError next "#{name} does not have a source defined:\n#{indent(e)}" end - unless last_command.stdout.strip == source + unless out.strip == source next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`" end end.compact @@ -172,9 +172,9 @@ module Spec rescue StandardError => e next "checking for #{name} failed:\n#{e}" end - next if last_command.stdout == "WIN" + next if out == "WIN" next "expected #{name} to not be installed, but it was" if version.nil? - if Gem::Version.new(last_command.stdout) == Gem::Version.new(version) + if Gem::Version.new(out) == Gem::Version.new(version) next "expected #{name} (#{version}) not to be installed, but it was" end end.compact -- cgit v1.2.1