mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Copy/paste to reimplement pending examples
This commit is contained in:
parent
56ae92a25d
commit
57c9f2c58e
1 changed files with 25 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue