Copy/paste to reimplement pending examples

This commit is contained in:
Michael Miller 2018-09-23 14:53:32 -06:00
parent 56ae92a25d
commit 57c9f2c58e

View file

@ -174,6 +174,31 @@ module Spectator
end
macro pending(description, &block)
class Wrapper%example
include ::Spectator::DSL::ExampleDSL
include {{@type.id}}
def initialize(locals : Hash(Symbol, ::Spectator::ValueWrapper))
super
end
def %run
{{block.body}}
end
end
class Example%example < ::Spectator::PendingExample
def initialize(group : ::Spectator::ExampleGroup, locals : Hash(Symbol, ::Spectator::ValueWrapper))
super
@instance = Wrapper%example.new(locals)
end
def description
{{description.is_a?(StringLiteral) ? description : description.stringify}}
end
end
::Spectator::DSL::Builder.add_example(Example%example)
end
def it_behaves_like