mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add documentation to ExampleConditions
This commit is contained in:
parent
db89a99562
commit
ec9416285b
1 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,13 @@
|
|||
module Spectator
|
||||
# Collection of checks that run before and after tests.
|
||||
# The pre-conditions can be used to verify
|
||||
# that the SUT is in an expected state prior to testing.
|
||||
# The post-conditions can be used to verify
|
||||
# that the SUT is in an expected state after tests have finished.
|
||||
# Each check is just a `Proc` (code block) that runs when invoked.
|
||||
class ExampleConditions
|
||||
# Creates an empty set of conditions.
|
||||
# This will effectively run nothing extra while running a test.
|
||||
def self.empty
|
||||
new(
|
||||
[] of ->,
|
||||
|
@ -7,16 +15,21 @@ module Spectator
|
|||
)
|
||||
end
|
||||
|
||||
# Creates a new set of conditions.
|
||||
def initialize(
|
||||
@pre_conditions : Array(->),
|
||||
@post_conditions : Array(->)
|
||||
)
|
||||
end
|
||||
|
||||
# Runs all pre-condition checks.
|
||||
# These should be run before every test.
|
||||
def run_pre_conditions
|
||||
@pre_conditions.each &.call
|
||||
end
|
||||
|
||||
# Runs all post-condition checks.
|
||||
# These should be run after every test.
|
||||
def run_post_conditions
|
||||
@post_conditions.each &.call
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue