summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-12 16:46:29 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-12 18:17:52 +0200
commit107f6e7799ae17fb6784cd69f99cf0ebc405413b (patch)
tree88a5310d9407fda5fd38a4674cdc32f2c98821ed
parentabc29c377f24554f7d3101cd5fd081cb1ec33a11 (diff)
downloadbundler-107f6e7799ae17fb6784cd69f99cf0ebc405413b.tar.gz
Fix spec calling incorrect helperfix_helpers_specs
The spec was crashing on bundler 3, but since the spec was checking for a failure status for the subprocess, it was actually passing. So, as part of this change, I make helper specs more resilient again. These specs were previously checking for a more specific status than 0 or 1, but I removed that at some point. Now I see how it was useful, so I'm restoring it.
-rw-r--r--spec/runtime/with_unbundled_env_spec.rb33
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 b4503cba32..1d0281e562 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