ExUnitFixtures v0.2.0 ExUnitFixtures.Imp

This module provides most of the implementation details of ExUnitFixtures.

It is seperated out from the main ExUnitFixtures file so the documentation for users is not mixed in with a bunch of irrelevant details.

Summary

Functions

Creates fixtures and their dependencies

Creates module scoped fixtures

Creates test scoped fixtures for a test, by examining it’s test context

Types

fixtures :: %{atom: term}

Functions

create_fixtures(fixtures, fixture_infos, existing_fixtures)

Specs

create_fixtures([:atom], fixture_infos, fixtures) :: fixtures

Creates fixtures and their dependencies.

This will create each fixture in fixtures using the FixtureInfo in fixture_infos. It takes care to create things in the correct order.

It returns a map of fixture name to created fixture.

module_scoped_fixtures(fixture_infos)

Specs

module_scoped_fixtures(fixture_infos) :: fixtures

Creates module scoped fixtures.

Module scoped fixtures behave slightly differently from test scoped fixtures, in that they are always created before every test in a module, regardless of whether that test actually requested that fixture or not.

Note that module scoped fixtures can not depend on the test context, as it has not been created at the point they are initialised.

test_scoped_fixtures(context, fixture_infos)

Specs

test_scoped_fixtures(%{}, fixture_infos) :: fixtures

Creates test scoped fixtures for a test, by examining it’s test context.

This should be passed:

It will return context with the requested fixtures added in, but also with any module level fixtures that were not requested stripped out.