summaryrefslogtreecommitdiff
path: root/spec/bundler/runtime/with_unbundled_env_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-01 12:49:40 +0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-06-09 12:44:10 +0900
commit8f37629519ad330032a38ac0e871b2912ed38a1b (patch)
treebb0529b77583d47993d8b0d608d68896aa3a5298 /spec/bundler/runtime/with_unbundled_env_spec.rb
parent66508992483ae5d77b56a98427c50c772341c0ac (diff)
Merge bundler master from upstream.
Pick from 8dd59e3ba97eb80a599f8149f31bf40773b69dc0
Diffstat (limited to 'spec/bundler/runtime/with_unbundled_env_spec.rb')
-rw-r--r--spec/bundler/runtime/with_unbundled_env_spec.rb35
1 files changed, 28 insertions, 7 deletions
diff --git a/spec/bundler/runtime/with_unbundled_env_spec.rb b/spec/bundler/runtime/with_unbundled_env_spec.rb
index b4503cba32..b901f28c8b 100644
--- a/spec/bundler/runtime/with_unbundled_env_spec.rb
+++ b/spec/bundler/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
@@ -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