summaryrefslogtreecommitdiff
path: root/spec/bundler/bundler/ui/shell_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 10:11:34 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-04 13:14:43 +0900
commit69ed64949b0c02d4b195809fa104ff23dd100093 (patch)
treec07abfd061a2da7610e252960c06a64e8b17e6c3 /spec/bundler/bundler/ui/shell_spec.rb
parent5537adf719a37a30b17d39111cc03700f353aa2d (diff)
Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4021
Diffstat (limited to 'spec/bundler/bundler/ui/shell_spec.rb')
-rw-r--r--spec/bundler/bundler/ui/shell_spec.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/spec/bundler/bundler/ui/shell_spec.rb b/spec/bundler/bundler/ui/shell_spec.rb
index 536014c6aa..15120a8a41 100644
--- a/spec/bundler/bundler/ui/shell_spec.rb
+++ b/spec/bundler/bundler/ui/shell_spec.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative "../../support/streams"
-
RSpec.describe Bundler::UI::Shell do
subject { described_class.new }
@@ -43,10 +41,19 @@ RSpec.describe Bundler::UI::Shell do
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")
+ output = begin
+ result = StringIO.new
+ result.close
+
+ $stderr = result
+
+ subject.error("Something went wrong")
+
+ result.string
+ ensure
+ $stderr = STDERR
+ end
+ expect(output).to_not eq("Something went wrong")
end
end
end