Fix .simplecov exit status for integration tests.

This commit is contained in:
Markus Reiter 2020-11-29 18:38:11 +01:00
parent 81203d346c
commit da8d91bd05
2 changed files with 6 additions and 4 deletions

View File

@ -30,8 +30,6 @@ SimpleCov.start do
SimpleCov.print_error_status = false
SimpleCov.at_exit do
$stdout.reopen("/dev/null")
# Just save result, but don't write formatted output.
coverage_result = Coverage.result
# TODO: this method is private, find a better way.
@ -39,7 +37,10 @@ SimpleCov.start do
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)
exit! SimpleCov.exit_status_from_exception || 0
# If an integration test raises a `SystemExit` exception on exit,
# exit immediately using the same status code to avoid reporting
# an error when expecting a non-successful exit status.
raise if $ERROR_INFO.is_a?(SystemExit)
end
else
command_name "#{command_name} (#{$PROCESS_ID})"

View File

@ -13,7 +13,8 @@ RSpec.shared_context "integration test" do
matcher :be_a_success do
match do |actual|
status = actual.is_a?(Proc) ? actual.call : actual
status.respond_to?(:success?) && status.success?
expect(status).to respond_to(:success?)
status.success?
end
def supports_block_expectations?