Pavlov.Callbacks

Allows running tasks in-between test executions. Currently only supports running tasks before tests are executed.

Context

If you return {:ok, <dict>} from before :all, the dictionary will be merged into the current context and be available in all subsequent setup_all, setup and the test itself.

Similarly, returning {:ok, <dict>} from before :each, the dict returned will be merged into the current context and be available in all subsequent setup and the test itself.

Returning :ok leaves the context unchanged in both cases.

Source

Summary

before(periodicity \\ :each, context \\ {:_, [], Pavlov.Callbacks}, contents)

Runs before each test in the current context is executed or before all tests in the context are executed

Macros

before(periodicity \\ :each, context \\ {:_, [], Pavlov.Callbacks}, contents)

Runs before each test in the current context is executed or before all tests in the context are executed.

Example:

before :all do
  IO.puts "Test batch started!"
  :ok
end

before :each do
  IO.puts "Here comes a new test!"
  :ok
end
Source