mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Minimal working double
This commit is contained in:
parent
bff2668ad4
commit
d08ec75db7
2 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
module Spectator
|
||||
abstract struct Double
|
||||
abstract class Double
|
||||
macro stub(definition)
|
||||
def {{definition.name.id}}
|
||||
{{definition.block.body}}
|
||||
|
|
13
src/spectator/dsl/mocks.cr
Normal file
13
src/spectator/dsl/mocks.cr
Normal file
|
@ -0,0 +1,13 @@
|
|||
require "../double"
|
||||
|
||||
module Spectator::DSL
|
||||
macro double(name, &block)
|
||||
{% if block.is_a?(Nop) %}
|
||||
Double{{name.id}}.new
|
||||
{% else %}
|
||||
class Double{{name.id}} < ::Spectator::Double
|
||||
{{block.body}}
|
||||
end
|
||||
{% end %}
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue