Use stub instead of abstract_stub by default for stub_all

RSpec doesn't appear to raise unexpected message errors for standard object methods (like to_s).
There are also a lot of issues that arise when requiring a stub on common methods.
This commit is contained in:
Michael Miller 2022-03-20 15:38:26 -06:00
parent c9f91299fe
commit 0fb7be6722
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -308,7 +308,7 @@ module Spectator
# Redefines all methods on a type to conditionally respond to messages.
# Methods will raise `UnexpectedMessage` if they're called when they shouldn't be.
# Otherwise, they'll return the configured response.
private macro stub_all(type_name, *, with style = :abstract_stub)
private macro stub_all(type_name, *, with style = :stub)
{% type = type_name.resolve %}
{% if type.superclass %}
stub_all({{type.superclass}}, with: {{style}})