mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Placeholder code for after hooks
This commit is contained in:
parent
19d57dd828
commit
0279606a1c
1 changed files with 16 additions and 0 deletions
|
@ -27,9 +27,25 @@ module Spectator::DSL
|
||||||
end
|
end
|
||||||
|
|
||||||
macro after_all(&block)
|
macro after_all(&block)
|
||||||
|
{% raise "Cannot use 'after_all' inside of a test block" if @def %}
|
||||||
|
|
||||||
|
def self.%hook : Nil
|
||||||
|
{{block.body}}
|
||||||
|
end
|
||||||
|
|
||||||
|
::Spectator::DSL::Builder.after_all { {{@type.name}}.%hook }
|
||||||
end
|
end
|
||||||
|
|
||||||
macro after_each(&block)
|
macro after_each(&block)
|
||||||
|
{% raise "Cannot use 'after_each' inside of a test block" if @def %}
|
||||||
|
|
||||||
|
def %hook : Nil
|
||||||
|
{{block.body}}
|
||||||
|
end
|
||||||
|
|
||||||
|
::Spectator::DSL::Builder.after_each do |example|
|
||||||
|
example.with_context({{@type.name}}) { %hook }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue