Merge pull request #7322 from reitermarkus/spec-helper

Improve spec helper.
This commit is contained in:
Markus Reiter 2020-04-10 20:44:06 +02:00 committed by GitHub
commit 5b775afedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,24 +173,25 @@ RSpec.configure do |config|
@__argv = ARGV.dup @__argv = ARGV.dup
@__env = ENV.to_hash # dup doesn't work on ENV @__env = ENV.to_hash # dup doesn't work on ENV
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
@__stdout = $stdout.clone @__stdout = $stdout.clone
@__stderr = $stderr.clone @__stderr = $stderr.clone
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
$stdout.reopen(File::NULL) $stdout.reopen(File::NULL)
$stderr.reopen(File::NULL) $stderr.reopen(File::NULL)
end end
example.run example.run
rescue SystemExit => e
raise "Unexpected exit with status #{e.status}."
ensure ensure
ARGV.replace(@__argv) ARGV.replace(@__argv)
ENV.replace(@__env) ENV.replace(@__env)
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
$stdout.reopen(@__stdout) $stdout.reopen(@__stdout)
$stderr.reopen(@__stderr) $stderr.reopen(@__stderr)
@__stdout.close @__stdout.close
@__stderr.close @__stderr.close
end
Formulary.clear_cache Formulary.clear_cache
Tap.clear_cache Tap.clear_cache