shard-spectator/spec/issues/github_issue_29_spec.cr

41 lines
597 B
Crystal
Raw Normal View History

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
2021-07-11 05:04:02 +00:00
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