ESpec v1.6.3 API Reference
Modules
A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily
A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily
The ESpec basic module. Imports a lot of ESpec components.
One should use the module in spec modules
Defines helper functions for mocking and stubbing. These functions wrap arguments for ESpec.AllowTo module
Defines to/2 function which makes the mock
Defines assert and refute helper functions
Defines assert_receive and assert_received helper macros
Defines helper functions for modules which use ESpec.
These functions wrap arguments for ESpec.ExpectTo module.
See ESpec.Assertion module for corresponding ‘assertion modules’
Defines ‘accepted’ assertion
Defines ‘assert_receive’ and ‘assert_received’ assertions
Defines ‘be’ assertion
Defines ‘be_between’ assertion
Defines ‘be_close_to’ assertion
Defines ‘be_type’ assertion
Defines ‘have_byte_size’ assertion
Defines ‘be_false’ assertion
Defines ‘be_true’ assertion
Defines ‘be_true’ assertion
Defines ‘be_truthy’ assertion
Defines ‘change’ assertion
Defines ‘change’ assertion
Defines ‘change’ assertion
Defines ‘change’ assertion
Defines the ‘contain_exactly’ assertion (or match_list) - the lists have the same elements (possibly in a different order)
Defines ‘be_empty’ assertion
Defines ‘have_all’ assertion
Defines ‘have_any’ assertion
Defines ‘have_count_by’ assertion
Defines ‘have_max’ assertion
Defines ‘have_max_by’ assertion
Defines ‘have_min’ assertion
Defines ‘have_min_by’ assertion
Defines ‘have’ assertion
Defines ‘have_at’ assertion
Defines ‘have_count’ assertion
Defines ‘eq’ (==) assertion
Defines ‘eql’ (===) assertion
Defines the assertion interface. There are 3 function should be defined in the ‘assertion’ module:
match/2;success_message/4;error_message/4
Defines ‘have_hd’ assertion
Defines ‘have_tl’ assertion
Defines ‘have_first’ assertion
Defines ‘have_last’ assertion
Defines ‘have_key’ assertion
Defines ‘have_value’ assertion
Defines ‘match’ (=~) assertion
Defines ‘match_pattern’ (=) assertion
Defines ‘be_alive’ assertion
Defines ‘raise_exception’ assertion
Defines ‘refute_receive’ and ‘refute_received’ assertions
Defines ‘be_ok_result’ assertion
Defines ‘be_ok_result’ assertion
Defines ‘be_blank’ assertion
Defines ‘be_printable’ assertion
Defines ‘be_valid_string’ assertion
Defines ‘end_with’ assertion
Defines ‘start_with’ assertion
Defines ‘throw_term’ assertion
Defines ‘before’ macro.
If before block returns {:ok, key: value},
the {key, value} is added to an ‘exapmle dict’.
The dict can be accessed in another before, in let,
and in example by shared (shared[:key])
Defines before_all and after_all macros
Handles ESpec configurations. @list contains all available keys in config
Defines macros ‘context’, ‘describe’, and ‘example_group’. Defines macros for ‘skip’ and ‘focus’ example groups
This protocol defines the API for functions which take a Date,
NaiveDateTime, or DateTime as input
The ESpec.DateTimes.Delegator module. Used to delegate methods to the correct protocol implementation
Defines the ‘described_module’ helper which makes accessing tested module possible. Keep in mind the convention ‘module TheModuleSpec is spec for TheModule’
Defines the ‘extract’ method with parse module content and return %ESpec.DocExample{} structs.
The struct is used by ‘ESpec.DocTest’ module to build the specs
Implements functionality similar to ExUnit.DocTest. Provides doctest macro. Read the ExUnit.DocTest documentation for more info
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
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
Contains all the functions need to run a ‘spec’ example
Defines expect and is_expected helper functions.
These functions wrap arguments for ESpec.ExpectTo module
Defines to and to_not functions which call specific ‘assertion’
Defines finally macro.
The block is evaluated after the example.
shared is available.
Define the finally before example!
Generates plain colored text output
Generates html output
Generates json output
Defines ‘let’, ‘let!’ and ‘subject’ macros.
‘let’ and ‘let!’ macros define named functions with cached return values.
The ‘let’ evaluate block in runtime when called first time.
The ‘let!’ evaluates as a before block just after all ‘befores’ for example.
The ‘subject’ macro is just an alias for let to define subject
‘let’ implementation is here
Defines ‘expect` function to mock function using ‘meck’. :meck.new is called with options :non_strict and :passthrough. The :non_strict allows create mocks for modules and functions that do not exist. The :passthrough options allow call other functions in the module. Information about mock is stored in the ‘:espec_mock_agent’ set. Mock are being unloaded after each example
Provides functions for output of spec results. Uses specified formatter to format results
Defines refute_receive and refute_received helper macros
Defines functions which runs the examples. Uses GenServer behavior
Implements queue
Defines should and should_not helpers
Defines functions for running specs in modules
Contains come functions for generating random function names
Defines to, to_not and not_to helper functions.
The functions implement syntax: ‘expect 1 |> to eq 1’
These functions wrap arguments for ESpec.ExpectTo module
A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily
Exceptions
Defines ESpec.AssertionError exception.
The exception is raised by ESpec.Assertions.Interface.raise_error/4 when example fails
Mix Tasks
Runs the specs
Creates necessary files