View Source GitHub.Testing.Mock (GitHub REST API Client v0.1.1)
Internal representation of a mocked API call
Link to this section Summary
Link to this section Types
@type args() :: [any()] | non_neg_integer()
Specification of arguments
Each set of arguments can be given as a list of elements to match or a total arity. When given
as a list, each element can be any Erlang term or the special value :_
to match any value.
Specifications given as a list will have higher precedence depending on the number of arguments
that match exactly.
@type limit() :: pos_integer() | :infinity
Limit to the number of times a mock can be used
The special value :infinity
can be used to place no limit.
@type return() :: {:ok, any()} | {:ok, any(), keyword()} | {:error, any()} | {:error, any(), keyword()}
Return value from a mocked API call
Return values are tagged tuples with optional additional information. For example:
{:ok, %GitHub.Repository{}}
{:ok, %GitHub.Repository{}, code: 200}
{:error, %GitHub.Error{}}
{:error, %GitHub.Error{}, code: 404}
For more on the possible values, see GitHub.Testing
.
Return value or generator of a mocked API call
This may be a constant (value) or a zero-arity function returning a constant (generator).
@type t() :: %GitHub.Testing.Mock{ args: args(), implicit: boolean(), limit: limit(), return: return_fun() }
Mocked API call