ESpec v1.8.0 ESpec.Example View Source

Defines macros 'example' and 'it'. These macros defines function with random name which will be called when example runs. Example structs %ESpec.Example are accumulated in @examples attribute

Link to this section Summary

Functions

Example struct. description - the description of example, module - spec module, function - random function name, opts - options, file - spec file path, line - the line where example is defined, context - example context. Accumulator for 'contexts' and 'lets', shared - marks example as shared, status - example status (:new, :success, :failure, :pending), result - the value returned by example block or the pending message, error - store an error, duration - test duration

Context descriptions

Extracts example options from most specific to least specific as Keyword list. Can include duplicates

Extracts specific structs from example context

Extracts example option

Extracts example options as they are currently valid for this example as map

Filters failed examples

Message for pending examples

Filters pending examples

Message for skipped examples

Filters success examples

Link to this section Types

Link to this type

t() View Source
t() :: %ESpec.Example{
  context: term(),
  description: term(),
  duration: term(),
  error: term(),
  file: term(),
  function: term(),
  line: term(),
  module: term(),
  opts: term(),
  result: term(),
  shared: term(),
  status: term()
}

Link to this section Functions

Link to this function

%ESpec.Example{} View Source (struct)

Example struct. description - the description of example, module - spec module, function - random function name, opts - options, file - spec file path, line - the line where example is defined, context - example context. Accumulator for 'contexts' and 'lets', shared - marks example as shared, status - example status (:new, :success, :failure, :pending), result - the value returned by example block or the pending message, error - store an error, duration - test duration.

Link to this function

context_descriptions(example) View Source

Context descriptions.

Link to this function

extract(context, module) View Source

Link to this function

extract_all_options(example) View Source
extract_all_options(t()) :: Keyword.t()

Extracts example options from most specific to least specific as Keyword list. Can include duplicates.

Link to this function

extract_befores(example) View Source

Extracts specific structs from example context.

Link to this function

extract_contexts(example) View Source

Link to this function

extract_finallies(example) View Source

Link to this function

extract_option(example, option) View Source
extract_option(t(), option :: atom()) :: nil | any()

Extracts example option.

Link to this function

extract_options(example) View Source
extract_options(t()) :: %{required(atom()) => any()}

Extracts example options as they are currently valid for this example as map.

Filters failed examples.

Link to this function

pending_message(example) View Source

Message for pending examples.

Filters pending examples.

Message for skipped examples.

Filters success examples.