mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Get contextual values working with doubles
This commit is contained in:
parent
d08ec75db7
commit
00c0553426
2 changed files with 15 additions and 2 deletions
|
@ -2,7 +2,13 @@ module Spectator
|
||||||
abstract class Double
|
abstract class Double
|
||||||
macro stub(definition)
|
macro stub(definition)
|
||||||
def {{definition.name.id}}
|
def {{definition.name.id}}
|
||||||
{{definition.block.body}}
|
@internal.{{definition.name.id}}
|
||||||
|
end
|
||||||
|
|
||||||
|
class Internal
|
||||||
|
def {{definition.name.id}}
|
||||||
|
{{definition.block.body}}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,9 +3,16 @@ require "../double"
|
||||||
module Spectator::DSL
|
module Spectator::DSL
|
||||||
macro double(name, &block)
|
macro double(name, &block)
|
||||||
{% if block.is_a?(Nop) %}
|
{% if block.is_a?(Nop) %}
|
||||||
Double{{name.id}}.new
|
Double{{name.id}}.new(@spectator_test_values)
|
||||||
{% else %}
|
{% else %}
|
||||||
class Double{{name.id}} < ::Spectator::Double
|
class Double{{name.id}} < ::Spectator::Double
|
||||||
|
class Internal < {{@type.id}}
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(test_values : ::Spectator::TestValues)
|
||||||
|
@internal = Internal.new(test_values)
|
||||||
|
end
|
||||||
|
|
||||||
{{block.body}}
|
{{block.body}}
|
||||||
end
|
end
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
Loading…
Reference in a new issue