Merge pull request #12967 from Bo98/tests-stdin
test/spec_helper: prevent stdin trashing
This commit is contained in:
commit
66c266a1db
@ -214,12 +214,14 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
@__stdout = $stdout.clone
|
@__stdout = $stdout.clone
|
||||||
@__stderr = $stderr.clone
|
@__stderr = $stderr.clone
|
||||||
|
@__stdin = $stdin.clone
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (example.metadata.keys & [:focus, :byebug]).empty? && !ENV.key?("HOMEBREW_VERBOSE_TESTS")
|
if (example.metadata.keys & [:focus, :byebug]).empty? && !ENV.key?("HOMEBREW_VERBOSE_TESTS")
|
||||||
$stdout.reopen(File::NULL)
|
$stdout.reopen(File::NULL)
|
||||||
$stderr.reopen(File::NULL)
|
$stderr.reopen(File::NULL)
|
||||||
end
|
end
|
||||||
|
$stdin.reopen(File::NULL)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
timeout = example.metadata.fetch(:timeout, 60)
|
timeout = example.metadata.fetch(:timeout, 60)
|
||||||
@ -236,8 +238,10 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
$stdout.reopen(@__stdout)
|
$stdout.reopen(@__stdout)
|
||||||
$stderr.reopen(@__stderr)
|
$stderr.reopen(@__stderr)
|
||||||
|
$stdin.reopen(@__stdin)
|
||||||
@__stdout.close
|
@__stdout.close
|
||||||
@__stderr.close
|
@__stderr.close
|
||||||
|
@__stdin.close
|
||||||
|
|
||||||
Formulary.clear_cache
|
Formulary.clear_cache
|
||||||
Tap.clear_cache
|
Tap.clear_cache
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user