2021-07-03 03:55:42 +00:00
|
|
|
require "../spec_helper"
|
|
|
|
|
|
|
|
Spectator.describe "GitHub Issue #29" do
|
|
|
|
class SomeClass
|
|
|
|
def goodbye
|
|
|
|
exit 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-03-19 23:20:15 +00:00
|
|
|
# mock SomeClass do
|
|
|
|
# inject_stub abstract def exit(code)
|
|
|
|
# end
|
2021-07-03 03:55:42 +00:00
|
|
|
|
|
|
|
describe SomeClass do
|
2022-03-19 23:20:15 +00:00
|
|
|
xit "captures exit", pending: "Mock redesign" do
|
2021-07-03 03:55:42 +00:00
|
|
|
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
|
|
|
|
|
2022-03-19 23:20:15 +00:00
|
|
|
# mock Foo do
|
|
|
|
# inject_stub abstract def self.exit(code)
|
|
|
|
# end
|
2021-07-11 05:04:02 +00:00
|
|
|
|
|
|
|
subject { Foo }
|
|
|
|
|
2022-03-19 23:20:15 +00:00
|
|
|
xit "must capture exit", pending: "Mock redesign" do
|
2021-07-11 05:04:02 +00:00
|
|
|
expect(subject).to receive(:exit).with(0)
|
|
|
|
|
|
|
|
subject.test
|
|
|
|
end
|
|
|
|
end
|
2021-07-03 03:55:42 +00:00
|
|
|
end
|