mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Playing around with mocking and type restrictions
This commit is contained in:
parent
86729c6745
commit
b44dee5331
1 changed files with 22 additions and 5 deletions
|
@ -111,12 +111,29 @@ module Spectator::DSL
|
|||
else
|
||||
:module
|
||||
end %}
|
||||
{% if block %}
|
||||
{% begin %}
|
||||
{{type.id}} ::{{resolved.id}}
|
||||
include ::Spectator::Mocks::Stubs
|
||||
|
||||
{{block.body}}
|
||||
end
|
||||
|
||||
{% if type == :class %}
|
||||
{{type.id}} Mock{{resolved.id}} < ::{{resolved.id}}
|
||||
end
|
||||
{% elsif type == :module %}
|
||||
class Mock{{resolved.id}}
|
||||
include ::{{resolved.id}}
|
||||
end
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% else %}
|
||||
{% if type == :struct %}
|
||||
{% raise "Cannot use mock(#{resolved.id}) to create a struct" %}
|
||||
{% else %}
|
||||
Mock{{resolved.id}}.new
|
||||
{% end %}
|
||||
{% end %}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue