View Source ExUnitAtlas (ex_unit_atlas v0.1.0)

Adds named behavior steps and checks to regular ExUnit tests.

Use this module after use ExUnit.Case (or a project-specific case template):

defmodule Shop.SaleTest do
  use ExUnit.Case, async: true
  use ExUnitAtlas

  test "cash sales are fiscalized" do
    sale =
      step "Create a cash sale" do
        %{payment_type: :cash}
      end

    check "The sale is eligible for fiscalization" do
      assert sale.payment_type == :cash
    end
  end
end

step/2 and check/2 preserve the return value and failure semantics of their blocks. Add ExUnitAtlas.Formatter alongside the standard ExUnit CLI formatter to generate the report.

Summary

Functions

Runs and records a named human-readable assertion block.

Runs and records a named scenario step.

Functions

Link to this macro

check(name, list)

View Source (macro)

Runs and records a named human-readable assertion block.

A check can contain one or more regular ExUnit assertions. Atlas does not inspect or replace them, and preserves their normal failures. The name must be a non-empty string. Nested items are not supported.

Link to this macro

step(name, list)

View Source (macro)

Runs and records a named scenario step.

The block is executed exactly once and its value is returned unchanged. Errors, exits and throws are re-raised with their original reason and stacktrace. The name must be a non-empty string. Nested items are not supported.