Minimal working double

This commit is contained in:
Michael Miller 2019-10-04 23:16:40 -06:00
parent bff2668ad4
commit d08ec75db7
2 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,5 @@
module Spectator module Spectator
abstract struct Double abstract class Double
macro stub(definition) macro stub(definition)
def {{definition.name.id}} def {{definition.name.id}}
{{definition.block.body}} {{definition.block.body}}

View 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