docs » cp.spec.Specification
A Specification is a list of definitions which will be run in sequence, and the results are collated. It is often created via the describe function.
Example usage:
local spec = require "cp.spec"
local describe, it = spec.describe, spec.it
return describe "a specification" {
it "performs an assertion"
:doing(function()
assert(true, "should not fail")
end),
}
- Functions - API calls offered directly by the extension
- is
- Constructors - API calls which return an object, typically one that offers API methods
- Specification
- Methods - API calls which can only be made on an object returned by a constructor
- onAfterEach
- onBeforeEach
- run
- with
Signature | cp.spec.Specification.is(instance) -> boolean |
---|---|
Type | Function |
Description | Checks if the instance is an instance of Specification . |
Returns |
|
Signature | cp.spec.Specification(name) -> cp.spec.Specification |
---|---|
Type | Constructor |
Description | Creates a new test suite. |
Signature | cp.spec.Specification:onAfterEach(afterEachFn) -> cp.spec.Specification |
---|---|
Type | Method |
Description | Specifies a function to execute after each of the contained specifications is run. |
Parameters |
|
Returns |
|
Signature | cp.spec.Specification:onBeforeEach(beforeEachFn) -> cp.spec.Specification |
---|---|
Type | Method |
Description | Specifies a function to execute before each of the contained specifications is run. |
Parameters |
|
Returns |
|
Signature | cp.spec.Specification:run() -> cp.spec.Run |
---|---|
Type | Method |
Description | Runs the specification, returning the Run instance, already running. |
Returns |
|
Signature | cp.spec.Specification:with(...) -> self |
---|---|
Type | Method |
Description | Adds the provided definitions to the suite. |
Parameters |
|
Returns |
|