View Source GitHub.Testing.Mock (GitHub REST API Client v0.0.3)

Internal representation of a mocked API call

Link to this section Summary

Types

Specification of arguments

Limit to the number of times a mock can be used

Return value from a mocked API call

t()

Mocked API call

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, integer(), any()}
  | {:error, any()}
  | (() -> {:ok, integer(), any()} | {:error, any()})

Return value from a mocked API call

This may be a constant (value) or a zero-arity function returning a constant (generator). In each case, the constant is a tagged tuple containing the status code and response.

@type t() :: %GitHub.Testing.Mock{
  args: args(),
  implicit: boolean(),
  limit: limit(),
  return: return()
}

Mocked API call