mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Don't embed mock info in type
This can cause problems. Need to use a registry approach.
This commit is contained in:
parent
875333cffe
commit
8c2f8d973b
1 changed files with 9 additions and 16 deletions
|
@ -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 %}
|
||||
|
|
Loading…
Reference in a new issue