Skip to content

Commit ddf2c90

Browse files
committed
Go back to exit 2 when coverage test fails
1 parent 6b728b5 commit ddf2c90

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/openapi_first/test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def self.handle_exit
6363

6464
return if Coverage.result.coverage >= configuration.minimum_coverage
6565

66-
raise OpenapiFirst::Test::CoverageError, 'Not all described requests and responses have been tested.'
66+
puts 'API Coverage fails with exit 2, because not all described requests and responses have been tested.'
67+
68+
exit 2
6769
end
6870

6971
# Print the coverage report

spec/test_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
expect(OpenapiFirst::Test).to receive(:report_coverage)
130130
expect do
131131
described_class.handle_exit
132-
end.to raise_error(OpenapiFirst::Test::CoverageError)
132+
end.to raise_error(SystemExit)
133133
end
134134

135135
context 'with full coverage' do
@@ -177,7 +177,7 @@
177177
expect(OpenapiFirst::Test).to receive(:report_coverage)
178178
expect do
179179
described_class.handle_exit
180-
end.to raise_error(OpenapiFirst::Test::CoverageError)
180+
end.to raise_error(SystemExit)
181181
end
182182
end
183183

0 commit comments

Comments
 (0)