Pavlov.Case
Use this module to prepare other modules for testing.
Example
defmodule MySpec do
use Pavlov.Case
it "always passes" do
assert true
end
end
Summary↑
describe(desc, \\ {:_, [], Pavlov.Case}, pending \\ false, contents) | You can nest your tests under a descriptive name. Tests can be infinitely nested |
it(desc, var \\ {:_, [], Pavlov.Case}, contents) | The cornerstone BDD macro, “it” allows your test to be defined via a string |
let(name, contents) | Allows lazy initialization of subjects for your tests. Subjects created via “let” will never leak into other contexts (defined via “describe” or “context”), not even those who are children of the context where the lazy subject is defined |
xdescribe(desc, \\ {:_, [], Pavlov.Case}, contents) | Defines a group of tests as pending. Any other contexts nested within an xdescribe will not run as well |
xit(description, var \\ {:_, [], Pavlov.Case}, contents) | Allows you specify a pending test, meaning that it is never run |
Macros
You can nest your tests under a descriptive name. Tests can be infinitely nested.
The cornerstone BDD macro, “it” allows your test to be defined via a string.
Example
it "is the truth" do
assert true == true
end
Allows lazy initialization of subjects for your tests. Subjects created via “let” will never leak into other contexts (defined via “describe” or “context”), not even those who are children of the context where the lazy subject is defined.
Example:
let :lazy do
"oh so lazy"
end
it "lazy initializes" do
assert lazy == "oh so lazy"
end
Defines a group of tests as pending. Any other contexts nested within an xdescribe will not run as well.
Allows you specify a pending test, meaning that it is never run.
Example
xit "is the truth" do
# This will never run
assert true == true
end