pact (pact_erlang v0.3.1)

View Source

Summary

Functions

Stops pact server

Asserts that each key of Value should match the given regular expression

Asserts the Term is an array type that consists of elements Like the one passed in

Enables pact ffi logs

Enables pact ffi logs

Creates a mock server with the given interaction details Returns its port for running pact consumer tests

Matches all the child objects (and their child objects etc.) Matched according to their types

Creates a test message with the given interaction details Returns message data for running message consumer tests

Asserts the value should match the given regular expression

Starts a new pact server and returns its pid Returns old instance's pid in case cleanup was not done correctly

Verifies Writes pact file and also finally cleanups

writes pact to the default directory path ./pacts

writes pact to the given directory path

Types

consumer/0

-type consumer() :: binary().

pact_interaction_details/0

-type pact_interaction_details() :: map().

pact_message_data/0

-type pact_message_data() :: map().

pact_mock_server_port/0

-type pact_mock_server_port() :: integer().

pact_pid/0

-type pact_pid() :: pid().

provider/0

-type provider() :: binary().

Functions

cleanup(PactPid)

-spec cleanup(pact_pid()) -> ok.

Stops pact server

each_key(Value, Regex)

-spec each_key(binary() | boolean() | number(), binary()) -> map().

Asserts that each key of Value should match the given regular expression

each_like(Term)

-spec each_like(any()) -> map().

Asserts the Term is an array type that consists of elements Like the one passed in

enable_logging(LogLevel)

-spec enable_logging(atom()) -> ok.

Enables pact ffi logs

enable_logging(FilePath, LogLevel)

-spec enable_logging(binary(), atom()) -> ok.

Enables pact ffi logs

interaction(PactPid, Interaction)

-spec interaction(pact_pid(), pact_interaction_details()) -> {ok, pact_mock_server_port()}.

Creates a mock server with the given interaction details Returns its port for running pact consumer tests

like(Term)

-spec like(any()) -> map().

Matches all the child objects (and their child objects etc.) Matched according to their types

msg_interaction(PactPid, Interaction)

-spec msg_interaction(pact_pid(), pact_interaction_details()) -> pact_message_data().

Creates a test message with the given interaction details Returns message data for running message consumer tests

regex_match(Value, Regex)

-spec regex_match(binary() | boolean() | number(), binary()) -> map().

Asserts the value should match the given regular expression

v4(Consumer, Provider)

-spec v4(consumer(), provider()) -> pact_pid().

Starts a new pact server and returns its pid Returns old instance's pid in case cleanup was not done correctly

verify(PactPid)

-spec verify(pact_pid()) -> {ok, matched} | {error, not_matched}.

Verifies Writes pact file and also finally cleanups

write(PactPid)

-spec write(pact_pid()) -> ok.

writes pact to the default directory path ./pacts

write(PactPid, Path)

-spec write(pact_pid(), binary()) -> ok.

writes pact to the given directory path