ESpec v0.7.1

Modules summary

ESpec

The ESpec basic module. Imports a lot of ESpec components. One should use the module in spec modules

ESpec.Allow

Defines helper functions for mocking and stubbinf. These fucntions wrap arguments for ESpec.AllowTo module

ESpec.AllowTo

Defines to/2 function which make the mock

ESpec.AssertionHelpers

Defines helper functions for modules which use ESpec. These functions wrap arguments for ESpec.ExpectTo module. See ESpec.Assertion module for corresponding ‘assertion modules’

ESpec.Assertions.Accepted

Defines ‘accepted’ assertion

ESpec.Assertions.Be

Defines ‘be’ assertion

ESpec.Assertions.BeBetween

Defines ‘be_between’ assertion

ESpec.Assertions.BeCloseTo

Defines ‘be_close_to’ assertion

ESpec.Assertions.BeType

Defines ‘be_type’ assertion

ESpec.Assertions.Boolean.BeFalse

Defines ‘be_false’ assertion

ESpec.Assertions.Boolean.BeFalsy

Defines ‘be_true’ assertion

ESpec.Assertions.Boolean.BeTrue

Defines ‘be_true’ assertion

ESpec.Assertions.Boolean.BeTruthy

Defines ‘be_true’ assertion

ESpec.Assertions.ChangeFromTo

Defines ‘change’ assertion

ESpec.Assertions.ChangeTo

Defines ‘change’ assertion

ESpec.Assertions.Dict.HaveKey

Defines ‘have_key’ assertion

ESpec.Assertions.Dict.HaveValue

Defines ‘have_value’ assertion

ESpec.Assertions.Enum.BeEmpty

Defines ‘be_empty’ assertion

ESpec.Assertions.Enum.HaveAll

Defines ‘have_all’ assertion

ESpec.Assertions.Enum.HaveAny

Defines ‘have_any’ assertion

ESpec.Assertions.Enum.HaveCountBy

Defines ‘have_count_by’ assertion

ESpec.Assertions.Enum.HaveMax

Defines ‘have_max’ assertion

ESpec.Assertions.Enum.HaveMaxBy

Defines ‘have_max_by’ assertion

ESpec.Assertions.Enum.HaveMin

Defines ‘have_min’ assertion

ESpec.Assertions.Enum.HaveMinBy

Defines ‘have_min_by’ assertion

ESpec.Assertions.EnumString.Have

Defines ‘have’ assertion

ESpec.Assertions.EnumString.HaveAt

Defines ‘have_at’ assertion

ESpec.Assertions.EnumString.HaveCount

Defines ‘have_count’ assertion

ESpec.Assertions.Eq

Defines ‘eq’ (==) assertion

ESpec.Assertions.Eql

Defines ‘eql’ (===) assertion

ESpec.Assertions.Interface

Defines the assertion interface. There are 3 function should be defined in the ‘assertion’ module:

  • match/2;
  • success_message/4;
  • error_message/4
ESpec.Assertions.List.HaveHd

Defines ‘have_hd’ assertion

ESpec.Assertions.List.HaveTl

Defines ‘have_tl’ assertion

ESpec.Assertions.ListString.HaveFirst

Defines ‘have_first’ assertion

ESpec.Assertions.ListString.HaveLast

Defines ‘have_last’ assertion

ESpec.Assertions.Match

Defines ‘match’ (=~) assertion

ESpec.Assertions.RaiseException

Defines ‘raise_exception’ assertion

ESpec.Assertions.String.BePrintable

Defines ‘be_printable’ assertion

ESpec.Assertions.String.BeValidString

Defines ‘be_valid_string’ assertion

ESpec.Assertions.String.EndWith

Defines ‘end_with’ assertion

ESpec.Assertions.String.StartWith

Defines ‘start_with’ assertion

ESpec.Assertions.ThrowTerm

Defines ‘throw_term’ assertion

ESpec.Before

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 __ (__[:key])

ESpec.Configuration

Handles ESpec configuraions. @list contains all available keys in config

ESpec.Context

Defines macros ‘context’, ‘describe’, and ‘example_group’. Defines macros for ‘skip’ and ‘focus’ example groups

ESpec.DocExample

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

ESpec.DocTest

Implements functionality similar to ExUnit.DocTest. Provides doctest macro. Read the ExUnit.DocTest documentation for more info

ESpec.Example

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

ESpec.ExampleHelpers

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

ESpec.ExampleRunner

Contains all the functions need to run a ‘spec’ example

ESpec.Expect

Defines expect and is_expected helper functions. These functions wrap arguments for ESpec.ExpectTo module

ESpec.ExpectTo

Defines to and to_not functions which call specific ‘assertion’

ESpec.Finally

Defines finally macro. The block is evaluated after the example. __ is available. Define the finally before example!

ESpec.Let

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

ESpec.Mock

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

ESpec.Output

Provides functions for output of spec results. Uses specified formatter to format results

ESpec.Output.Doc

Generates plain colored text output

ESpec.Output.Html

Generates html output

ESpec.Output.Json

Generates json output

ESpec.Runner

Defines functions which runs the examples. Uses GenServer behavior

ESpec.Should

Defines should and should_not helpers

ESpec.Support

Contains come function for generating random fucntion names

Mix.Tasks.Espec

Runs the specs

Mix.Tasks.Espec.Init

Exceptions summary

ESpec.AssertionError

Defines ESpec.AssertionError exception. The exception is raised by ESpec.Assertions.Interface.raise_error/4 when example fails

ESpec.DocExample.Error