summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-04-14 12:04:15 +0000
committerBundlerbot <bot@bundler.io>2019-04-14 12:04:15 +0000
commit9424cedb913b738bbd733e30c772524ea054f5fe (patch)
tree8bd3e0dbedcacd4e05d1126c819807ece21dbd3e
parenta53709556b95a914e874b22ed2116a46b0528852 (diff)
parentc494e1261268a5249b6406fe35709016f7c4c3ac (diff)
downloadbundler-9424cedb913b738bbd733e30c772524ea054f5fe.tar.gz
Merge #6730
6730: Print errors to stderr by default, and remove configuration option r=greysteil a=greysteil ### What was the end-user problem that led to this PR? The problem was #6729 - Bundler unexpectedly outputs error and warning messages to STDOUT. ### What was your diagnosis of the problem? My diagnosis was that whilst very minorly breaking, this is essentially a bug fix, and should be considered for inclusion for Bundler 2.0 even if very few other breaking changes are. ### What is your fix for the problem, implemented in this PR? My fix was so switch output for warning and error messages to STDERR, and remove the configuration option (as is redundant once the setup is flipped - anyone wanting to redirect those message to STDOUT could do so in their shell). ### Why did you choose this fix out of the possible options? I chose this fix because I think the new behaviour is what everyone would expect, and we should get it out from behind its feature switch sooner rather than later. Alternatively, we might want to keep the Bundler 2.0 release "purer" by only dropping Ruby versions in it - that's totally fine too, but I figured we should have the code to discus #6729, rather than doing it in abstract. Co-authored-by: Grey Baker <greysteil@gmail.com> Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/settings.rb1
-rw-r--r--lib/bundler/ui/shell.rb6
-rw-r--r--man/bundle-config.ronn2
-rw-r--r--spec/bundler/cli_spec.rb14
-rw-r--r--spec/bundler/friendly_errors_spec.rb2
-rw-r--r--spec/bundler/ui/shell_spec.rb24
-rw-r--r--spec/cache/git_spec.rb2
-rw-r--r--spec/commands/add_spec.rb2
-rw-r--r--spec/commands/binstubs_spec.rb18
-rw-r--r--spec/commands/check_spec.rb2
-rw-r--r--spec/commands/config_spec.rb38
-rw-r--r--spec/commands/exec_spec.rb22
-rw-r--r--spec/commands/init_spec.rb2
-rw-r--r--spec/commands/install_spec.rb4
-rw-r--r--spec/commands/lock_spec.rb2
-rw-r--r--spec/commands/newgem_spec.rb12
-rw-r--r--spec/commands/package_spec.rb2
-rw-r--r--spec/commands/update_spec.rb6
-rw-r--r--spec/install/bundler_spec.rb6
-rw-r--r--spec/install/deploy_spec.rb2
-rw-r--r--spec/install/failure_spec.rb8
-rw-r--r--spec/install/gemfile/gemspec_spec.rb4
-rw-r--r--spec/install/gemfile/git_spec.rb18
-rw-r--r--spec/install/gemfile/path_spec.rb2
-rw-r--r--spec/install/gems/compact_index_spec.rb2
-rw-r--r--spec/install/gems/flex_spec.rb4
-rw-r--r--spec/install/gems/resolving_spec.rb6
-rw-r--r--spec/install/gems/standalone_spec.rb16
-rw-r--r--spec/install/gemspecs_spec.rb4
-rw-r--r--spec/install/path_spec.rb2
-rw-r--r--spec/lock/lockfile_spec.rb12
-rw-r--r--spec/other/cli_dispatch_spec.rb8
-rw-r--r--spec/quality_spec.rb4
-rw-r--r--spec/realworld/edgecases_spec.rb4
-rw-r--r--spec/realworld/mirror_probe_spec.rb4
-rw-r--r--spec/runtime/gem_tasks_spec.rb4
-rw-r--r--spec/runtime/inline_spec.rb18
-rw-r--r--spec/runtime/require_spec.rb10
-rw-r--r--spec/runtime/setup_spec.rb50
-rw-r--r--spec/runtime/with_unbundled_env_spec.rb2
-rw-r--r--spec/support/command_execution.rb8
-rw-r--r--spec/support/helpers.rb4
-rw-r--r--spec/support/matchers.rb8
-rw-r--r--spec/update/git_spec.rb4
45 files changed, 174 insertions, 202 deletions
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 982f0fa540..07106abad7 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -36,7 +36,6 @@ module Bundler
settings_flag(:default_install_uses_path) { bundler_3_mode? }
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
settings_flag(:disable_multisource) { bundler_3_mode? }
- settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_3_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_3_mode? }
settings_flag(:global_gem_cache) { bundler_3_mode? }
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 5bc190865f..d21789dba1 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -28,7 +28,6 @@ module Bundler
disable_platform_warnings
disable_shared_gems
disable_version_check
- error_on_stderr
force_ruby_platform
forget_cli_options
frozen
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 16e3d15713..7136fdfbf9 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -35,14 +35,12 @@ module Bundler
return if @warning_history.include? msg
@warning_history << msg
- return tell_err(msg, :yellow, newline) if Bundler.feature_flag.error_on_stderr?
- tell_me(msg, :yellow, newline)
+ tell_err(msg, :yellow, newline)
end
def error(msg, newline = nil)
return unless level("error")
- return tell_err(msg, :red, newline) if Bundler.feature_flag.error_on_stderr?
- tell_me(msg, :red, newline)
+ tell_err(msg, :red, newline)
end
def debug(msg, newline = nil)
diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn
index 86c4e21819..9242a59f95 100644
--- a/man/bundle-config.ronn
+++ b/man/bundle-config.ronn
@@ -183,8 +183,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
* `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
Stop Bundler from checking if a newer Bundler version is available on
rubygems.org.
-* `error_on_stderr` (`BUNDLE_ERROR_ON_STDERR`):
- Print Bundler errors to stderr.
* `force_ruby_platform` (`BUNDLE_FORCE_RUBY_PLATFORM`):
Ignore the current machine's platform and install only `ruby` platform gems.
As a result, gems with native extensions will be compiled from source.
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 6a505358d1..2e12fbfc6b 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -30,8 +30,8 @@ RSpec.describe "bundle executable" do
context "with no arguments" do
it "prints a concise help message", :bundler => "3" do
bundle! ""
- expect(last_command.stderr).to be_empty
- expect(last_command.stdout).to include("Bundler version #{Bundler::VERSION}").
+ expect(err).to be_empty
+ 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
@@ -125,7 +125,7 @@ RSpec.describe "bundle executable" do
let(:latest_version) { "222.0" }
it "prints the version warning" do
bundle "fail"
- expect(last_command.stdout).to start_with(<<-EOS.strip)
+ expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler`
EOS
@@ -150,7 +150,7 @@ To install the latest version, run `gem install bundler`
let(:latest_version) { "222.0.0.pre.4" }
it "prints the version warning" do
bundle "fail"
- expect(last_command.stdout).to start_with(<<-EOS.strip)
+ expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler --pre`
EOS
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb
index 4ca1e543c1..07ec196b86 100644
--- a/spec/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/friendly_errors_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe Bundler, "friendly errors" do
bundle :install, :env => { "DEBUG" => true }
- expect(last_command.stderr).to include("Failed to load #{home(".gemrc")}")
+ expect(err).to include("Failed to load #{home(".gemrc")}")
expect(exitstatus).to eq(0) if exitstatus
end
end
diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb
index 23a7670dd1..632477096e 100644
--- a/spec/bundler/ui/shell_spec.rb
+++ b/spec/bundler/ui/shell_spec.rb
@@ -24,13 +24,6 @@ RSpec.describe Bundler::UI::Shell do
it "prints to stderr" do
expect { subject.warn("warning") }.to output("warning\n").to_stderr
end
-
- context "when stderr flag is enabled" do
- before { Bundler.settings.temporary(:error_on_stderr => true) }
- it "prints to stderr" do
- expect { subject.warn("warning!") }.to output("warning!\n").to_stderr
- end
- end
end
describe "#debug" do
@@ -46,19 +39,12 @@ RSpec.describe Bundler::UI::Shell do
expect { subject.error("error!!!") }.to output("error!!!\n").to_stderr
end
- context "when stderr flag is enabled" do
- before { Bundler.settings.temporary(:error_on_stderr => true) }
- it "prints to stderr" do
- expect { subject.error("error!!!") }.to output("error!!!\n").to_stderr
- end
-
- context "when stderr is closed" do
- it "doesn't report anything" do
- output = capture(:stderr, :closed => true) do
- subject.error("Something went wrong")
- end
- expect(output).to_not eq("Something went wrong\n")
+ context "when stderr is closed" do
+ it "doesn't report anything" do
+ output = capture(:stderr, :closed => true) do
+ subject.error("Something went wrong")
end
+ expect(output).to_not eq("Something went wrong\n")
end
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/add_spec.rb b/spec/commands/add_spec.rb
index dac1d0f6b9..7d435916db 100644
--- a/spec/commands/add_spec.rb
+++ b/spec/commands/add_spec.rb
@@ -21,7 +21,7 @@ RSpec.describe "bundle add" do
it "shows error" do
bundle "add"
- expect(last_command.bundler_err).to include("Please specify gems to add")
+ expect(err).to include("Please specify gems to add")
end
end
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 3f62f17b45..77f23b9a2f 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe "bundle binstubs <gem>" do
bundle "binstubs rack", :all => true
expect(last_command).to be_failure
- expect(last_command.bundler_err).to include("Cannot specify --all with specific gems")
+ expect(err).to include("Cannot specify --all with specific gems")
end
context "when generating bundle binstub outside bundler" do
@@ -88,7 +88,7 @@ RSpec.describe "bundle binstubs <gem>" do
sys_exec "bin/rackup"
- expect(last_command.stderr).to include("was not generated by Bundler")
+ expect(err).to include("was not generated by Bundler")
end
end
@@ -135,7 +135,7 @@ RSpec.describe "bundle binstubs <gem>" do
it "runs the correct version of bundler" do
sys_exec "#{bundled_app("bin/bundle")} install", "BUNDLER_VERSION" => "999.999.999"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:").
+ expect(err).to include("Activating bundler (999.999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
end
end
@@ -145,7 +145,7 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "999.999.999")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:").
+ expect(err).to include("Activating bundler (999.999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
end
@@ -154,7 +154,7 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "44.0")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (44.0) failed:").
+ expect(err).to include("Activating bundler (44.0) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '44.0'`")
end
@@ -163,7 +163,7 @@ RSpec.describe "bundle binstubs <gem>" do
lockfile lockfile.gsub(system_bundler_version, "2.12.0.a")
sys_exec "#{bundled_app("bin/bundle")} install"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (2.12.0.a) failed:").
+ expect(err).to include("Activating bundler (2.12.0.a) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '2.12.0.a'`")
end
end
@@ -173,13 +173,13 @@ RSpec.describe "bundle binstubs <gem>" 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
sys_exec "#{bundled_app("bin/bundle")} update --bundler=999.999.999"
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:").
+ expect(err).to include("Activating bundler (999.999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
end
end
@@ -205,7 +205,7 @@ RSpec.describe "bundle binstubs <gem>" do
it "attempts to load that version", :ruby_repo do
sys_exec bundled_app("bin/rackup").to_s
expect(exitstatus).to eq(42) if exitstatus
- expect(last_command.stderr).to include("Activating bundler (999.999.999) failed:").
+ expect(err).to include("Activating bundler (999.999.999) failed:").
and include("To install the version of bundler this project requires, run `gem install bundler -v '999.999.999'`")
end
end
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index 7114610644..cf88736612 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -338,7 +338,7 @@ RSpec.describe "bundle check" do
it "does not change the lock but warns" do
lockfile lock_with(Bundler::VERSION.succ)
bundle! :check
- expect(last_command.bundler_err).to include("the running version of Bundler (#{Bundler::VERSION}) is older than the version that created the lockfile (#{Bundler::VERSION.succ})")
+ expect(err).to include("the running version of Bundler (#{Bundler::VERSION}) is older than the version that created the lockfile (#{Bundler::VERSION.succ})")
lockfile_should_be lock_with(Bundler::VERSION.succ)
end
end
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index 84f882b410..f5b3e7c998 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -391,86 +391,86 @@ 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
- expect(last_command.bundler_err).to eq "The options global and local were specified. Please only use one of the switches at a time."
+ expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time."
end
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"
expect(last_command).to be_failure
- expect(last_command.bundler_err).to eq "The options global and local were specified. Please only use one of the switches at a time."
+ expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time."
end
end
end
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index a95383ee97..655313534d 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -88,14 +88,14 @@ RSpec.describe "bundle exec" do
sys_exec "#{Gem.ruby} #{command.path}"
expect(out).to eq("")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "accepts --keep-file-descriptors" do
install_gemfile ""
bundle "exec --keep-file-descriptors echo foobar"
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "can run a command named --verbose" do
@@ -156,7 +156,7 @@ RSpec.describe "bundle exec" do
bundle! "exec irb --version"
expect(out).to include(default_irb_version)
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
@@ -182,7 +182,7 @@ RSpec.describe "bundle exec" do
bundle! "exec irb --version"
expect(out).to include(specified_irb_version)
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
@@ -212,7 +212,7 @@ RSpec.describe "bundle exec" do
it "uses resolved version" do
expect(out).to include(indirect_irb_version)
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
end
@@ -334,7 +334,7 @@ RSpec.describe "bundle exec" do
[true, false].each do |l|
bundle! "config set disable_exec_load #{l}"
bundle "exec rackup"
- 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?"
+ 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?"
end
end
@@ -552,8 +552,8 @@ RSpec.describe "bundle exec" do
bundle "exec irb"
- expect(last_command.stderr).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
- expect(last_command.stderr).to match('"TODO" is not a summary')
+ expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
+ expect(err).to match('"TODO" is not a summary')
end
end
@@ -614,8 +614,8 @@ RSpec.describe "bundle exec" do
it "like a normally executed executable" do
subject
expect(exitstatus).to eq(exit_code) if exitstatus
- expect(last_command.stderr).to eq(expected_err)
- expect(last_command.stdout).to eq(expected)
+ expect(err).to eq(expected_err)
+ expect(out).to eq(expected)
end
end
@@ -886,7 +886,7 @@ __FILE__: #{path.to_s.inspect}
# sanity check that we get the newer, custom version without bundler
sys_exec("#{Gem.ruby} #{file}")
- expect(last_command.stderr).to include("custom openssl should not be loaded")
+ expect(err).to include("custom openssl should not be loaded")
end
end
end
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb
index 64849beeb9..7960ce85bd 100644
--- a/spec/commands/init_spec.rb
+++ b/spec/commands/init_spec.rb
@@ -94,7 +94,7 @@ RSpec.describe "bundle init" do
end
bundle :init, :gemspec => spec_file
- expect(last_command.bundler_err).to include("There was an error while loading `test.gemspec`")
+ expect(err).to include("There was an error while loading `test.gemspec`")
end
end
end
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index 21157dd309..1a027a77c9 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -16,7 +16,7 @@ RSpec.describe "bundle install with gem sources" do
raise StandardError, "FAIL"
G
- expect(last_command.bundler_err).to include('StandardError, "FAIL"')
+ expect(err).to include('StandardError, "FAIL"')
expect(bundled_app("Gemfile.lock")).not_to exist
end
@@ -404,7 +404,7 @@ RSpec.describe "bundle install with gem sources" do
G
expect(last_command.stdboth).not_to match(/Error Report/i)
- expect(last_command.bundler_err).to include("An error occurred while installing ajp-rails (0.0.0), and Bundler cannot continue.").
+ expect(err).to include("An error occurred while installing ajp-rails (0.0.0), and Bundler cannot continue.").
and include(normalize_uri_file("Make sure that `gem install ajp-rails -v '0.0.0' --source 'file://localhost#{gem_repo2}/'` succeeds before bundling."))
end
diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb
index f876d719cc..7aaf5c178e 100644
--- a/spec/commands/lock_spec.rb
+++ b/spec/commands/lock_spec.rb
@@ -242,7 +242,7 @@ RSpec.describe "bundle lock" do
it "errors when removing all platforms" do
bundle "lock --remove-platform #{local_platforms.join(" ")}"
- expect(last_command.bundler_err).to include("Removing all platforms from the bundle is not allowed")
+ expect(err).to include("Removing all platforms from the bundle is not allowed")
end
# from https://github.com/bundler/bundler/issues/4896
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 0d1058ad11..bb04f33c80 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -770,22 +770,22 @@ RSpec.describe "bundle gem" do
it "fails gracefully with a ." do
bundle "gem foo.gemspec"
- expect(last_command.bundler_err).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name")
+ expect(err).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name")
end
it "fails gracefully with a ^" do
bundle "gem ^"
- expect(last_command.bundler_err).to end_with("Invalid gem name ^ -- `^` is an invalid constant name")
+ expect(err).to end_with("Invalid gem name ^ -- `^` is an invalid constant name")
end
it "fails gracefully with a space" do
bundle "gem 'foo bar'"
- expect(last_command.bundler_err).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name")
+ expect(err).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name")
end
it "fails gracefully when multiple names are passed" do
bundle "gem foo bar baz"
- expect(last_command.bundler_err).to eq(<<-E.strip)
+ expect(err).to eq(<<-E.strip)
ERROR: "bundle gem" was called with arguments ["foo", "bar", "baz"]
Usage: "bundle gem NAME [OPTIONS]"
E
@@ -876,7 +876,7 @@ Usage: "bundle gem NAME [OPTIONS]"
FileUtils.touch("conflict-foobar")
end
bundle "gem conflict-foobar"
- expect(last_command.bundler_err).to include("Errno::ENOTDIR")
+ expect(err).to include("Errno::ENOTDIR")
expect(exitstatus).to eql(32) if exitstatus
end
end
@@ -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/commands/package_spec.rb b/spec/commands/package_spec.rb
index 6cd8e3f85a..b9cc079c5c 100644
--- a/spec/commands/package_spec.rb
+++ b/spec/commands/package_spec.rb
@@ -278,7 +278,7 @@ RSpec.describe "bundle install with gem sources" do
end
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(the_bundle).to include_gems "rack 1.0"
end
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index 46c208db6c..d78ee26c1f 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -565,13 +565,13 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler"
it "should explain that bundler conflicted", :bundler => "< 3" do
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).
+ expect(err).to match(/current Bundler version/i).
and match(/perhaps you need to update bundler/i)
end
it "should warn that the newer version of Bundler would conflict", :bundler => "3" do
bundle! "update", :all => true
- expect(last_command.bundler_err).to include("rails (3.0.1) has dependency bundler").
+ expect(err).to include("rails (3.0.1) has dependency bundler").
and include("so the dependency is being ignored")
expect(the_bundle).to include_gem "rails 3.0.1"
end
@@ -947,7 +947,7 @@ RSpec.describe "bundle update conservative" do
it "raises if too many flags are provided" do
bundle "update --patch --minor", :all => true
- expect(last_command.bundler_err).to eq "Provide only one of the following options: minor, patch"
+ expect(err).to eq "Provide only one of the following options: minor, patch"
end
end
end
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index 3347988cdd..90f7c63330 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -48,7 +48,7 @@ RSpec.describe "bundle install" do
Could not find gem 'bundler (= 0.9.2)' in any
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "works for gems with multiple versions in its dependencies" do
@@ -104,7 +104,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "causes a conflict if a child dependency conflicts with the Gemfile" do
@@ -122,7 +122,7 @@ RSpec.describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(last_command.bundler_err).to include(nice_error)
+ expect(err).to include(nice_error)
end
it "can install dependencies with newer bundler version with system gems" do
diff --git a/spec/install/deploy_spec.rb b/spec/install/deploy_spec.rb
index 918dbabfbe..2df6127d51 100644
--- a/spec/install/deploy_spec.rb
+++ b/spec/install/deploy_spec.rb
@@ -366,7 +366,7 @@ RSpec.describe "install with --deployment or --frozen" do
G
expect(the_bundle).not_to include_gems "rack 1.0.0"
- expect(last_command.stderr).to include strip_whitespace(<<-E).strip
+ expect(err).to include strip_whitespace(<<-E).strip
The dependencies in your gemfile changed
You have added to the Gemfile:
diff --git a/spec/install/failure_spec.rb b/spec/install/failure_spec.rb
index 49e2771dca..ac3c707187 100644
--- a/spec/install/failure_spec.rb
+++ b/spec/install/failure_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe "bundle install" do
source "file:\/\/localhost#{gem_repo2}"
gem "rails"
G
- expect(last_command.bundler_err).to end_with(normalize_uri_file(<<-M.strip))
+ expect(err).to end_with(normalize_uri_file(<<-M.strip))
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
Make sure that `gem install activesupport -v '2.3.2' --source 'file://localhost#{gem_repo2}/'` succeeds before bundling.
@@ -46,7 +46,7 @@ In Gemfile:
gem "activesupport", :git => "#{lib_path("activesupport")}"
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
In Gemfile:
@@ -77,7 +77,7 @@ In Gemfile:
end
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
@@ -111,7 +111,7 @@ In Gemfile:
gem "rails"
end
G
- expect(last_command.bundler_err).to end_with(normalize_uri_file(<<-M.strip))
+ expect(err).to end_with(normalize_uri_file(<<-M.strip))
An error occurred while installing activesupport (2.3.2), and Bundler cannot continue.
Make sure that `gem install activesupport -v '2.3.2' --source 'file://localhost#{gem_repo2}/'` succeeds before bundling.
diff --git a/spec/install/gemfile/gemspec_spec.rb b/spec/install/gemfile/gemspec_spec.rb
index 0bec2e9d96..bf1f4d7b9a 100644
--- a/spec/install/gemfile/gemspec_spec.rb
+++ b/spec/install/gemfile/gemspec_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are no gemspecs at #{tmp.join('foo')}/)
end
it "should raise if there are too many gemspecs available" do
@@ -77,7 +77,7 @@ RSpec.describe "bundle install from an existing gemspec" do
source "file://#{gem_repo2}"
gemspec :path => '#{tmp.join("foo")}'
G
- expect(last_command.bundler_err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
+ expect(err).to match(/There are multiple gemspecs at #{tmp.join('foo')}/)
end
it "should pick a specific gemspec" do
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index f208853041..785bf4336e 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run <<-RUBY
require 'foo'
@@ -234,7 +234,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -270,7 +270,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo"
end
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
run! <<-RUBY
require 'foo'
@@ -515,7 +515,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "explodes and gives correct solution if branch is not given on install" do
@@ -537,7 +537,7 @@ RSpec.describe "bundle install with git sources" do
bundle solution
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "does not explode if disable_local_branch_check is given" do
@@ -1197,7 +1197,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
- expect(last_command.bundler_err).to end_with(<<-M.strip)
+ expect(err).to end_with(<<-M.strip)
An error occurred while installing foo (1.0), and Bundler cannot continue.
In Gemfile:
@@ -1380,7 +1380,7 @@ In Gemfile:
with_path_as("") do
bundle "update", :all => true
end
- expect(last_command.bundler_err).
+ expect(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")
end
@@ -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/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index 54a41b576f..c6856ac974 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -313,7 +313,7 @@ RSpec.describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "removes the .gem file after installing" do
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/flex_spec.rb b/spec/install/gems/flex_spec.rb
index aeb83d6573..d15841124a 100644
--- a/spec/install/gems/flex_spec.rb
+++ b/spec/install/gems/flex_spec.rb
@@ -188,7 +188,7 @@ RSpec.describe "bundle flex_install" do
ruby <<-RUBY
require 'bundler/setup'
RUBY
- expect(last_command.stderr).to match(/could not find gem 'rack-obama/i)
+ expect(err).to match(/could not find gem 'rack-obama/i)
end
it "suggests bundle update when the Gemfile requires different versions than the lock" do
@@ -209,7 +209,7 @@ RSpec.describe "bundle flex_install" do
E
bundle :install, :retry => 0
- expect(last_command.bundler_err).to end_with(nice_error)
+ expect(err).to end_with(nice_error)
end
end
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index cf3aaa719e..7bab676cea 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER" => "1" }
- expect(last_command.stderr).to include("Creating possibility state for net_c")
+ expect(err).to include("Creating possibility state for net_c")
end
end
@@ -91,7 +91,7 @@ RSpec.describe "bundle install with install-time dependencies" do
bundle :install, :env => { "DEBUG_RESOLVER_TREE" => "1" }
- expect(last_command.stderr).to include(" net_b").
+ expect(err).to include(" net_b").
and include("Starting resolution").
and include("Finished resolution").
and include("Attempting to activate")
@@ -171,7 +171,7 @@ RSpec.describe "bundle install with install-time dependencies" do
Ruby\0 (> 9000), which is required by gem 'require_ruby', is not available in the local ruby installation
E
- expect(last_command.bundler_err).to end_with(nice_error)
+ expect(err).to end_with(nice_error)
end
end
diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb
index e2cfe5ec4c..68796977a4 100644
--- a/spec/install/gems/standalone_spec.rb
+++ b/spec/install/gems/standalone_spec.rb
@@ -175,8 +175,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --without to limit the groups used in a standalone" do
@@ -193,8 +193,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
it "allows --path to change the location of the standalone bundle", :bundler => "< 3" do
@@ -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,8 +245,8 @@ RSpec.shared_examples "bundle install --standalone" do
RUBY
end
- expect(last_command.stdout).to eq("2.3.2")
- expect(last_command.stderr).to eq("ZOMG LOAD ERROR")
+ expect(out).to eq("2.3.2")
+ expect(err).to eq("ZOMG LOAD ERROR")
end
end
diff --git a/spec/install/gemspecs_spec.rb b/spec/install/gemspecs_spec.rb
index c9878ccae8..55c7a67b4b 100644
--- a/spec/install/gemspecs_spec.rb
+++ b/spec/install/gemspecs_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe "bundle install" do
gem "yaml_spec"
G
bundle :install
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "still installs correctly when using path" do
@@ -23,7 +23,7 @@ RSpec.describe "bundle install" do
install_gemfile <<-G
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb
index 0947ed9539..aac697fb23 100644
--- a/spec/install/path_spec.rb
+++ b/spec/install/path_spec.rb
@@ -226,7 +226,7 @@ RSpec.describe "bundle install" do
vendored_gems("extensions").rmtree
run "require 'very_simple_binary_c'"
- expect(last_command.stderr).to include("Bundler::GemNotFound")
+ expect(err).to include("Bundler::GemNotFound")
bundle :install, forgotten_command_line_options(:path => "./vendor/bundle")
diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb
index 5ee44bf779..0842a94fc5 100644
--- a/spec/lock/lockfile_spec.rb
+++ b/spec/lock/lockfile_spec.rb
@@ -183,7 +183,7 @@ RSpec.describe "the lockfile format" do
"than the version that created the lockfile (9999999.1.0). " \
"We suggest you to upgrade to the version that created the " \
"lockfile by running `gem install bundler:9999999.1.0`."
- expect(last_command.stderr).to include warning_message
+ expect(err).to include warning_message
lockfile_should_be <<-G
GEM
@@ -227,7 +227,7 @@ RSpec.describe "the lockfile format" do
G
expect(last_command).to be_failure
- expect(last_command.bundler_err).to include("You must use Bundler 9999999 or greater with this lockfile.")
+ expect(err).to include("You must use Bundler 9999999 or greater with this lockfile.")
end
it "shows a friendly error when running with a new bundler 2 lockfile" do
@@ -293,7 +293,7 @@ RSpec.describe "the lockfile format" do
G
end
- expect(last_command.stderr).to include(
+ expect(err).to include(
"Warning: the lockfile is being updated to Bundler " \
"9999999, after which you will be unable to return to Bundler 1."
)
@@ -340,7 +340,7 @@ RSpec.describe "the lockfile format" do
gem "rack"
G
- expect(last_command.stderr).to include(
+ expect(err).to include(
"Warning: the lockfile is being updated to Bundler " \
"9999999, after which you will be unable to return to Bundler 1."
)
@@ -1579,7 +1579,7 @@ RSpec.describe "the lockfile format" do
gem "rack"
G
- expect(last_command.bundler_err).to match(/your Gemfile.lock contains merge conflicts/i)
- expect(last_command.bundler_err).to match(/git checkout HEAD -- Gemfile.lock/i)
+ expect(err).to match(/your Gemfile.lock contains merge conflicts/i)
+ expect(err).to match(/git checkout HEAD -- Gemfile.lock/i)
end
end
diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb
index 67127fc6e0..548539ac89 100644
--- a/spec/other/cli_dispatch_spec.rb
+++ b/spec/other/cli_dispatch_spec.rb
@@ -3,19 +3,19 @@
RSpec.describe "bundle command names" do
it "work when given fully" do
bundle "install"
- expect(last_command.bundler_err).to eq("Could not locate Gemfile")
+ expect(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(last_command.bundler_err).to eq("Could not locate Gemfile")
+ expect(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
bundle "in"
- expect(last_command.bundler_err).to eq("Ambiguous command in matches [info, init, inject, install]")
+ expect(err).to eq("Ambiguous command in matches [info, init, inject, install]")
end
context "when cache_command_is_package is set" do
@@ -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/quality_spec.rb b/spec/quality_spec.rb
index f9c815aee1..219a6bc85d 100644
--- a/spec/quality_spec.rb
+++ b/spec/quality_spec.rb
@@ -225,9 +225,9 @@ RSpec.describe "The library itself" do
end
# there's no way around this warning
- last_command.stderr.sub!(/^YAML safe loading.*/, "")
+ err.sub!(/^YAML safe loading.*/, "")
- expect(last_command.stderr).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
+ expect(err).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
ensure
# clean up the .gem generated
FileUtils.rm("bundler-#{Bundler::VERSION}.gem")
diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb
index a3662c91e7..6468ee7f1e 100644
--- a/spec/realworld/edgecases_spec.rb
+++ b/spec/realworld/edgecases_spec.rb
@@ -204,7 +204,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
bundle "config set --local path vendor/bundle"
bundle! :install
expect(err).not_to include("Could not find rake")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "checks out git repos when the lockfile is corrupted" do
@@ -331,7 +331,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
L
bundle! :lock
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "outputs a helpful error message when gems have invalid gemspecs" do
diff --git a/spec/realworld/mirror_probe_spec.rb b/spec/realworld/mirror_probe_spec.rb
index c5e95f3059..13d1afe124 100644
--- a/spec/realworld/mirror_probe_spec.rb
+++ b/spec/realworld/mirror_probe_spec.rb
@@ -86,8 +86,8 @@ 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(last_command.bundler_err).to include <<-EOS.strip
+ 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}/
Retrying fetcher due to error (4/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 3c69f8a800..459b554353 100644
--- a/spec/runtime/gem_tasks_spec.rb
+++ b/spec/runtime/gem_tasks_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do
sys_exec "#{rake} -T"
end
- expect(last_command.stderr).to eq("")
+ expect(err).to eq("")
expected_tasks = [
"rake build",
"rake clean",
@@ -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 96a3fa09ae..5738c042bf 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe "bundler/inline#gemfile" do
puts "success"
RUBY
- expect(last_command.stderr).to include "Could not find gem 'eleven'"
+ expect(err).to include "Could not find gem 'eleven'"
expect(out).not_to include "success"
script <<-RUBY
@@ -90,7 +90,7 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to include("Installing activesupport")
err.gsub! %r{.*lib/sinatra/base\.rb:\d+: warning: constant ::Fixnum is deprecated$}, ""
err.strip!
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -134,7 +134,7 @@ RSpec.describe "bundler/inline#gemfile" do
puts "success"
RUBY
- expect(last_command.stderr).to include "Unknown options: arglebargle"
+ expect(err).to include "Unknown options: arglebargle"
expect(out).not_to include "success"
end
@@ -165,7 +165,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("1.0.0")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -183,7 +183,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("1.0.0\n2.0.0")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -203,7 +203,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
expect(out).to eq("two\nfour")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -240,7 +240,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
end
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -258,7 +258,7 @@ RSpec.describe "bundler/inline#gemfile" do
RUBY
end
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(exitstatus).to be_zero if exitstatus
end
@@ -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/require_spec.rb b/spec/runtime/require_spec.rb
index c9cfa199d3..f149c9d489 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -136,8 +136,8 @@ RSpec.describe "Bundler.require" do
G
run "Bundler.require"
- expect(last_command.stderr).to match("error while trying to load the gem 'faulty'")
- expect(last_command.stderr).to match("Gem Internal Error Message")
+ expect(err).to match("error while trying to load the gem 'faulty'")
+ expect(err).to match("Gem Internal Error Message")
end
it "doesn't swallow the error when the library has an unrelated error" do
@@ -198,7 +198,7 @@ RSpec.describe "Bundler.require" do
RUBY
ruby(cmd)
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "does not mangle explicitly given requires" do
@@ -432,7 +432,7 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
G
run "Bundler.require"
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "requires gems pinned to multiple platforms, including the current one" do
@@ -447,6 +447,6 @@ RSpec.describe "Bundler.require with platform specific dependencies" do
run "Bundler.require; puts RACK"
expect(out).to eq("1.0.0")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index c81baa34ea..90c3df8661 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -19,7 +19,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to eq("1.0.0")
end
end
@@ -45,7 +45,7 @@ RSpec.describe "Bundler.setup" do
puts "WIN"
end
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to eq("WIN")
end
@@ -58,7 +58,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to eq("1.0.0")
end
@@ -72,7 +72,7 @@ RSpec.describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to eq("1.0.0")
end
@@ -90,7 +90,7 @@ RSpec.describe "Bundler.setup" do
puts "FAIL"
end
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to match("WIN")
end
@@ -104,8 +104,8 @@ RSpec.describe "Bundler.setup" do
puts "FAIL"
RUBY
- expect(last_command.stderr).to match("rack")
- expect(last_command.stderr).to match("LoadError")
+ expect(err).to match("rack")
+ expect(err).to match("LoadError")
expect(out).not_to match("FAIL")
end
end
@@ -141,7 +141,7 @@ RSpec.describe "Bundler.setup" do
load_path = out.split("\n")
rack_load_order = load_path.index {|path| path.include?("rack") }
- expect(last_command.stderr).to eq("")
+ expect(err).to eq("")
expect(load_path).to include(a_string_ending_with("dash_i_dir"), "rubylib_dir")
expect(rack_load_order).to be > 0
end
@@ -364,7 +364,7 @@ RSpec.describe "Bundler.setup" do
end
R
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "replaces #gem but raises when the version is wrong" do
@@ -390,7 +390,7 @@ RSpec.describe "Bundler.setup" do
end
R
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
@@ -449,7 +449,7 @@ RSpec.describe "Bundler.setup" do
it "provides a useful exception when the git repo is not checked out yet" do
run "1"
- expect(last_command.stderr).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
+ expect(err).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
end
it "does not hit the git binary if the lockfile is available and up to date" do
@@ -535,7 +535,7 @@ RSpec.describe "Bundler.setup" do
FileUtils.rm_rf(lib_path("local-rack"))
run "require 'rack'"
- expect(last_command.stderr).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
+ expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
end
it "explodes if branch is not given on runtime" do
@@ -557,7 +557,7 @@ RSpec.describe "Bundler.setup" do
G
run "require 'rack'"
- expect(last_command.stderr).to match(/because :branch is not specified in Gemfile/)
+ expect(err).to match(/because :branch is not specified in Gemfile/)
end
it "explodes on different branches on runtime" do
@@ -579,7 +579,7 @@ RSpec.describe "Bundler.setup" do
G
run "require 'rack'"
- expect(last_command.stderr).to match(/is using branch master but Gemfile specifies changed/)
+ expect(err).to match(/is using branch master but Gemfile specifies changed/)
end
it "explodes on refs with different branches on runtime" do
@@ -599,7 +599,7 @@ RSpec.describe "Bundler.setup" do
bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
- expect(last_command.stderr).to match(/is using branch master but Gemfile specifies nonexistant/)
+ expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
end
end
@@ -711,7 +711,7 @@ end
ENV["GEM_HOME"] = ""
bundle %(exec ruby -e "require 'set'")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
describe "$MANPATH" do
@@ -878,7 +878,7 @@ end
require 'foo'
R
end
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
@@ -903,7 +903,7 @@ end
R
end
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
@@ -1053,7 +1053,7 @@ end
Bundler.load
RUBY
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to eq("")
end
end
@@ -1065,7 +1065,7 @@ end
G
bundle %(exec ruby -e "require 'bundler'; Bundler.setup")
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
end
end
@@ -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
@@ -1355,7 +1355,7 @@ end
RUBY
expect(last_command.stdboth).not_to include "FAIL"
- expect(last_command.stderr).to include "private method `gem'"
+ expect(err).to include "private method `gem'"
end
it "keeps Kernel#require private" do
@@ -1371,7 +1371,7 @@ end
RUBY
expect(last_command.stdboth).not_to include "FAIL"
- expect(last_command.stderr).to include "private method `require'"
+ expect(err).to include "private method `require'"
end
end
end
diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb
index b4503cba32..69a0dd731f 100644
--- a/spec/runtime/with_unbundled_env_spec.rb
+++ b/spec/runtime/with_unbundled_env_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe "Bundler.with_env helpers" do
build_bundler_context
bundle! "exec '#{Gem.ruby}' #{bundled_app("exe.rb")} 2"
end
- expect(last_command.stderr).to eq <<-EOS.strip
+ expect(err).to eq <<-EOS.strip
2 false
1 true
0 true
diff --git a/spec/support/command_execution.rb b/spec/support/command_execution.rb
index 556285ac52..cec531d6c3 100644
--- a/spec/support/command_execution.rb
+++ b/spec/support/command_execution.rb
@@ -27,14 +27,6 @@ module Spec
@stdboth ||= [stderr, stdout].join("\n").strip
end
- def bundler_err
- if Bundler::VERSION.start_with?("1.")
- stdout
- else
- stderr
- end
- end
-
def to_s_verbose
[
to_s,
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 09e7419a98..478fe60822 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -45,13 +45,13 @@ module Spec
end
def err
- Bundler.feature_flag.error_on_stderr? ? last_command.stderr : last_command.stdout
+ last_command.stderr
end
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
def err_without_deprecations
- last_command.stderr.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
+ err.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
end
def deprecations
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
diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb
index 4fe22269e2..bc230a3575 100644
--- a/spec/update/git_spec.rb
+++ b/spec/update/git_spec.rb
@@ -88,7 +88,7 @@ RSpec.describe "bundle update" do
gem "foo", "1.0", :git => "#{lib_path("foo_two")}"
G
- expect(last_command.stderr).to be_empty
+ expect(err).to be_empty
expect(out).to include("Fetching #{lib_path}/foo_two")
expect(out).to include("Bundle complete!")
end
@@ -192,7 +192,7 @@ RSpec.describe "bundle update" do
lib_path("foo-1.0").join(".git").rmtree
bundle :update, :all => true
- expect(last_command.bundler_err).to include(lib_path("foo-1.0").to_s).
+ expect(err).to include(lib_path("foo-1.0").to_s).
and match(/Git error: command `git fetch.+has failed/)
end