Test class method usage

This commit is contained in:
Michael Miller 2021-07-10 23:04:02 -06:00
parent 766b6b17c7
commit 7210b8e11c
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -17,4 +17,24 @@ Spectator.describe "GitHub Issue #29" do
subject.goodbye
end
end
describe "class method" do
class Foo
def self.test
exit 0
end
end
mock Foo do
stub self.exit(code)
end
subject { Foo }
it "must capture exit" do
expect(subject).to receive(:exit).with(0)
subject.test
end
end
end