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
|
class Context
|
||||||
getter examples = [] of Example
|
getter examples = [] of Example
|
||||||
getter contexts = [] of Context
|
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
|
def all_examples
|
||||||
add_examples
|
add_examples
|
||||||
|
|
|
@ -139,24 +139,24 @@ module Spectator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_all
|
macro before_all(&block)
|
||||||
raise NotImplementedError.new("Spectator::DSL#before_all")
|
CURRENT_CONTEXT.before_all_hooks << -> {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_each
|
macro before_each(&block)
|
||||||
raise NotImplementedError.new("Spectator::DSL#before_each")
|
CURRENT_CONTEXT.before_each_hooks << -> {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_all
|
macro after_all(&block)
|
||||||
raise NotImplementedError.new("Spectator::DSL#after_all")
|
CURRENT_CONTEXT.after_all_hooks << -> {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_each
|
macro after_each(&block)
|
||||||
raise NotImplementedError.new("Spectator::DSL#after_each")
|
CURRENT_CONTEXT.after_each_hooks << -> {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def around_each
|
macro around_each(&block)
|
||||||
raise NotImplementedError.new("Spectator::DSL#around_each")
|
CURRENT_CONTEXT.around_each_hooks << -> {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_examples
|
def include_examples
|
||||||
|
|
Loading…
Reference in a new issue