Don't embed mock info in type

This can cause problems. Need to use a registry approach.
This commit is contained in:
Michael Miller 2019-11-09 09:03:07 -07:00
parent 875333cffe
commit 8c2f8d973b

View file

@ -18,11 +18,6 @@ module Spectator::DSL
end
macro mock(name, &block)
{% if block.is_a?(Nop) %}
{{name}}.new.tap do |%inst|
%inst.spectator_test = self
end
{% else %}
{% resolved = name.resolve
type = if resolved < Reference
:class
@ -31,12 +26,10 @@ module Spectator::DSL
else
:module
end %}
{% begin %}
{{type.id}} ::{{resolved.id}}
include ::Spectator::Mocks::Stubs
@spectator_stubs = Deque(::Spectator::Mocks::MethodStub).new
@spectator_stub_calls = Deque(::Spectator::Mocks::MethodCall).new
{{block.body}}
end
{% end %}