summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-10-30 16:13:53 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-10-31 12:03:51 +0100
commit1b89f68a38f51f422481c2f7921d104c93f69e15 (patch)
treeb55139b803b6194259a6e8e5a7a41f3b6a363c31
parent36816866581147ba7bd491a2a658ac35a2f03afe (diff)
downloadbundler-1b89f68a38f51f422481c2f7921d104c93f69e15.tar.gz
Revert "Avoid printing deprecation messages during specs"
This reverts commit 0a67ac4dc2bad753e33e11352e97f73c9c1ddeee. And fixes deprecation warnings in another way not that the UI verbosity is predictable.
-rw-r--r--spec/runtime/with_unbundled_env_spec.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb
index 05f3c8e3ab..254f493042 100644
--- a/spec/runtime/with_unbundled_env_spec.rb
+++ b/spec/runtime/with_unbundled_env_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../support/streams"
-
RSpec.describe "Bundler.with_env helpers" do
def bundle_exec_ruby!(code, options = {})
build_bundler_context options
@@ -129,16 +127,16 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.with_clean_env", :bundler => 2 do
it "should set ENV to unbundled_env in the block" do
expected = Bundler.unbundled_env
- actual = nil
- capture(:stderr) do
- actual = Bundler.with_clean_env { ENV.to_hash }
+
+ actual = Bundler.ui.silence do
+ Bundler.with_clean_env { ENV.to_hash }
end
expect(actual).to eq(expected)
end
it "should restore the environment after execution" do
- capture(:stderr) do
+ Bundler.ui.silence do
Bundler.with_clean_env { ENV["FOO"] = "hello" }
end
@@ -181,9 +179,7 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.clean_system", :bundler => 2 do
let(:code) do
<<~RUBY
- capture(:stderr) do
- Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42))
- end
+ Bundler.ui.silence { Bundler.clean_system(%([ "\$BUNDLE_FOO" = "bar" ] || exit 42)) }
exit $?.exitstatus
RUBY
@@ -191,7 +187,7 @@ RSpec.describe "Bundler.with_env helpers" do
it "runs system inside with_clean_env" do
lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib}:#{spec} -rsupport/streams -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(42)
end
end
@@ -237,10 +233,8 @@ RSpec.describe "Bundler.with_env helpers" do
describe "Bundler.clean_exec", :bundler => 2 do
let(:code) do
<<~RUBY
- capture(:stderr) do
- Process.fork do
- exit Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar"))
- end
+ Process.fork do
+ exit Bundler.ui.silence { Bundler.clean_exec(%(test "\$BUNDLE_FOO" = "bar")) }
end
_, status = Process.wait2
@@ -253,7 +247,7 @@ RSpec.describe "Bundler.with_env helpers" do
skip "Fork not implemented" if Gem.win_platform?
lib = File.expand_path("../../lib", __dir__)
- system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib}:#{spec} -rsupport/streams -rbundler -e '#{code}'")
+ system({ "BUNDLE_FOO" => "bar" }, "ruby -I#{lib} -rbundler -e '#{code}'")
expect($?.exitstatus).to eq(1)
end
end