Functions for writing specs.
A spec is a collection of scenarios, each of which provides an example that illustrates a behavior belonging to your program. Each scenario follows the same basic plan:
Here's a sample spec for a browser program called App:
Spec.describe "some part of my system"
[ Spec.scenario "the awesome path" (
Spec.given (
Spec.Setup.init (App.init testFlags)
|> Spec.Setup.withView App.view
|> Spec.Setup.withUpdate App.update
)
|> Spec.when "something happens"
[ Spec.Markup.target << by [ id "some-button" ]
, Spec.Markup.Event.click
]
|> Spec.it "does the right thing" (
Spec.Markup.observeElement
|> Spec.Markup.query << by [ id "some-words" ]
|> Spec.expect (Spec.Markup.hasText "something awesome")
)
)
]Represents a particular scenario in a spec.
Specify a description and a list of scenarios that compose the spec.
Create a scenario with a description and a plan.
Represents the setup and steps involved in a scenario.
Provide the Setup that represents the state of the world at the start of the scenario.
See Spec.Setup for functions to construct this representation.
Specify a description and the steps involved in a scenario.
Each step is a function from Step.Context to Step.Command, but usually
you will use steps that are provided by other modules, like Spec.Markup.Event.
You may provide multiple when blocks as part of a scenario.
Represents the full plan (setup, steps, expectations) involved in a scenario.
Specify an expectation to be checked once the scenario's steps have been performed.
Specify multiple expectations to be checked once the scenario's steps have been performed.
Provide an observer with a claim to evaluate.
Represents the spec.