Add test case handling NoReturn stub and top-level methods (exit)

Fixes https://github.com/icy-arctic-fox/spectator/issues/29
This commit is contained in:
Michael Miller 2021-07-02 21:55:42 -06:00
parent 92dbfc2a8e
commit f728ab6ad7
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,20 @@
require "../spec_helper"
Spectator.describe "GitHub Issue #29" do
class SomeClass
def goodbye
exit 0
end
end
mock SomeClass do
stub exit(code)
end
describe SomeClass do
it "captures exit" do
expect(subject).to receive(:exit).with(0)
subject.goodbye
end
end
end