Test type restricted methods with class mocks

This commit is contained in:
Michael Miller 2022-07-07 19:00:07 -06:00
parent 5008923226
commit ccc8997cca
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -359,6 +359,14 @@ Spectator.describe Spectator::Mock do
end
end
def restricted(thing : Thing.class)
thing.foo
end
it "can be used in type restricted methods" do
expect(restricted(mock)).to eq(:stub)
end
describe "._spectator_clear_stubs" do
before_each { mock._spectator_define_stub(foo_stub) }
@ -670,6 +678,14 @@ Spectator.describe Spectator::Mock do
end
end
def restricted(thing : Thing.class)
thing.foo
end
it "can be used in type restricted methods" do
expect(restricted(mock)).to eq(:stub)
end
describe "._spectator_clear_stubs" do
before_each { mock._spectator_define_stub(foo_stub) }