diff options
author | Bundlerbot <bot@bundler.io> | 2019-04-14 18:20:33 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-04-14 18:20:33 +0000 |
commit | 242e5d55dd69185dde5797876eb318ed23728b7d (patch) | |
tree | 91a79e287050594f62bdd54bd58ca7176489caf3 | |
parent | b165ba236f3f39245bfa3c3aca88153a3a0341e3 (diff) | |
parent | 107f6e7799ae17fb6784cd69f99cf0ebc405413b (diff) | |
download | bundler-242e5d55dd69185dde5797876eb318ed23728b7d.tar.gz |
Merge #7120
7120: Fix spec calling incorrect helper r=deivid-rodriguez a=deivid-rodriguez
Thanks so much for the contribution!
To make reviewing this PR a bit easier, please fill out answers to the following questions.
### What was the end-user problem that led to this PR?
The problem was the subprocess spawed by one spec was crashing, but that was not making the spec fail.
### What was your diagnosis of the problem?
My diagnosis was that since the spec was checking for a failure status of the subprocess, that was not specific enough to detect the particular bug in this spec (it was calling `clean_system`, removed from bundler 3, instead of `unbundled_system`).
### What is your fix for the problem, implemented in this PR?
My fix is to restore the previous strategy for these specs, namely, check for a more specific status than 0
or 1.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | spec/runtime/with_unbundled_env_spec.rb | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb index 69a0dd731f..b901f28c8b 100644 --- a/spec/runtime/with_unbundled_env_spec.rb +++ b/spec/runtime/with_unbundled_env_spec.rb @@ -153,29 +153,50 @@ RSpec.describe "Bundler.with_env helpers" do end describe "Bundler.original_system" do + let(:code) do + <<~RUBY + Bundler.original_system(%([ "\$BUNDLE_FOO" = "bar" ] && exit 42)) + + exit $?.exitstatus + RUBY + end + it "runs system inside with_original_env" do - code = 'exit Bundler.original_system(%(test "\$BUNDLE_FOO" = "bar"))' lib = File.expand_path("../../lib", __dir__) system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'") - expect($?.exitstatus).to eq(0) + expect($?.exitstatus).to eq(42) end end describe "Bundler.clean_system", :bundler => 2 do + let(:code) do + <<~RUBY + Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42)) + + exit $?.exitstatus + RUBY + end + it "runs system inside with_clean_env" do - code = 'exit Bundler.clean_system(%(test "\$BUNDLE_FOO" = "bar"))' lib = File.expand_path("../../lib", __dir__) system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'") - expect($?.exitstatus).to eq(1) + expect($?.exitstatus).to eq(42) end end describe "Bundler.unbundled_system" do + let(:code) do + <<~RUBY + Bundler.unbundled_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42)) + + exit $?.exitstatus + RUBY + end + it "runs system inside with_unbundled_env" do - code = 'exit Bundler.clean_system(%(test "\$BUNDLE_FOO" = "bar"))' lib = File.expand_path("../../lib", __dir__) system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'") - expect($?.exitstatus).to eq(1) + expect($?.exitstatus).to eq(42) end end |