Add short before/after hook name

This commit is contained in:
Michael Miller 2022-11-04 16:55:31 -06:00
parent 24fd7d1e91
commit 4906dfae0d
No known key found for this signature in database
GPG Key ID: 32B47AE8F388A1FF
1 changed files with 15 additions and 0 deletions

View File

@ -124,11 +124,21 @@ module Spectator::DSL
# This means that values defined by `let` and `subject` are available.
define_example_hook :before_each
# :ditto:
macro before(&block)
before_each {{block}}
end
# Defines a block of code that will be invoked after every example in the group.
# The block will be run in the context of the current running example.
# This means that values defined by `let` and `subject` are available.
define_example_hook :after_each
# :ditto:
macro after(&block)
after_each {{block}}
end
# Defines a block of code that will be invoked around every example in the group.
# The block will be run in the context of the current running example.
# This means that values defined by `let` and `subject` are available.
@ -139,6 +149,11 @@ module Spectator::DSL
# More code can run afterwards (in the block).
define_example_hook :around_each
# :ditto:
macro around(&block)
around_each {{block}}
end
# Defines a block of code that will be invoked before every example in the group.
# The block will be run in the context of the current running example.
# This means that values defined by `let` and `subject` are available.