ESpec v0.8.8 API Reference
Modules
The ESpec basic module. Imports a lot of ESpec components.
One should use the module in spec modules
Defines helper functions for mocking and stubbinf. These fucntions wrap arguments for ESpec.AllowTo module
Defines to/2 function which makes the mock
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 ‘be’ assertion
Defines ‘be_between’ assertion
Defines ‘be_close_to’ assertion
Defines ‘be_type’ assertion
Defines ‘be_false’ assertion
Defines ‘be_true’ assertion
Defines ‘be_true’ assertion
Defines ‘be_true’ assertion
Defines ‘change’ assertion
Defines ‘change’ assertion
Defines ‘have_key’ assertion
Defines ‘have_value’ assertion
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 ‘match’ (=~) assertion
Defines ‘raise_exception’ 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])
Handles ESpec configuraions. @list contains all available keys in config
Defines macros ‘context’, ‘describe’, and ‘example_group’. Defines macros for ‘skip’ and ‘focus’ example groups
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!
Defines ‘let’, ‘let!’ and ‘subject’ macrsos.
‘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
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 :passthroug 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
Generates plain colored text output
Generates html output
Generates json output
Defines functions which runs the examples. Uses GenServer behavior
Defines should and should_not helpers
Contains come function for generating random fucntion 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
Runs the specs
Exceptions
Defines ESpec.AssertionError exception.
The exception is raised by ESpec.Assertions.Interface.raise_error/4 when example fails