mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement creation of hooks
This commit is contained in:
parent
387e129a89
commit
2ff8ebb3cb
2 changed files with 15 additions and 10 deletions
|
@ -4,6 +4,11 @@ module Spectator
|
|||
class Context
|
||||
getter examples = [] of Example
|
||||
getter contexts = [] of Context
|
||||
getter before_all_hooks = [] of ->
|
||||
getter before_each_hooks = [] of ->
|
||||
getter after_all_hooks = [] of ->
|
||||
getter after_each_hooks = [] of ->
|
||||
getter around_each_hooks = [] of Example ->
|
||||
|
||||
def all_examples
|
||||
add_examples
|
||||
|
|
|
@ -139,24 +139,24 @@ module Spectator
|
|||
end
|
||||
end
|
||||
|
||||
def before_all
|
||||
raise NotImplementedError.new("Spectator::DSL#before_all")
|
||||
macro before_all(&block)
|
||||
CURRENT_CONTEXT.before_all_hooks << -> {{block}}
|
||||
end
|
||||
|
||||
def before_each
|
||||
raise NotImplementedError.new("Spectator::DSL#before_each")
|
||||
macro before_each(&block)
|
||||
CURRENT_CONTEXT.before_each_hooks << -> {{block}}
|
||||
end
|
||||
|
||||
def after_all
|
||||
raise NotImplementedError.new("Spectator::DSL#after_all")
|
||||
macro after_all(&block)
|
||||
CURRENT_CONTEXT.after_all_hooks << -> {{block}}
|
||||
end
|
||||
|
||||
def after_each
|
||||
raise NotImplementedError.new("Spectator::DSL#after_each")
|
||||
macro after_each(&block)
|
||||
CURRENT_CONTEXT.after_each_hooks << -> {{block}}
|
||||
end
|
||||
|
||||
def around_each
|
||||
raise NotImplementedError.new("Spectator::DSL#around_each")
|
||||
macro around_each(&block)
|
||||
CURRENT_CONTEXT.around_each_hooks << -> {{block}}
|
||||
end
|
||||
|
||||
def include_examples
|
||||
|
|
Loading…
Reference in a new issue