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.Claim.isSomethingWhere <|
Spec.Markup.text <|
Spec.Claim.isStringContaining "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.
Represents what should be the case about some part of the world.
Expectations are checked at the end of the scenario, after all steps of the script have been performed.
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.
Associate one or more tags with a scenario.
When you run the spec suite with tags specified, only the scenarios tagged with those tags will be executed.
If you just want to run one or more specific scenarios for debugging or development
purposes, see Spec.Runner.pick, which is more convenient to use for those
cases.
Represents the spec.