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,25 +18,18 @@ module Spectator::DSL
|
||||||
end
|
end
|
||||||
|
|
||||||
macro mock(name, &block)
|
macro mock(name, &block)
|
||||||
{% if block.is_a?(Nop) %}
|
{% resolved = name.resolve
|
||||||
{{name}}.new.tap do |%inst|
|
type = if resolved < Reference
|
||||||
%inst.spectator_test = self
|
:class
|
||||||
end
|
elsif resolved < Value
|
||||||
{% else %}
|
:struct
|
||||||
{% resolved = name.resolve
|
else
|
||||||
type = if resolved < Reference
|
:module
|
||||||
:class
|
end %}
|
||||||
elsif resolved < Value
|
{% begin %}
|
||||||
:struct
|
|
||||||
else
|
|
||||||
:module
|
|
||||||
end %}
|
|
||||||
{{type.id}} ::{{resolved.id}}
|
{{type.id}} ::{{resolved.id}}
|
||||||
include ::Spectator::Mocks::Stubs
|
include ::Spectator::Mocks::Stubs
|
||||||
|
|
||||||
@spectator_stubs = Deque(::Spectator::Mocks::MethodStub).new
|
|
||||||
@spectator_stub_calls = Deque(::Spectator::Mocks::MethodCall).new
|
|
||||||
|
|
||||||
{{block.body}}
|
{{block.body}}
|
||||||
end
|
end
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
Loading…
Reference in a new issue