Pact.Builders.PactBuilder (pact_consumer_ex v0.4.2)

Copy Markdown

Builder for Pact objects.

Summary

Functions

Add a new HTTP Interaction to the Pact. Needs to return a clone of the builder that is passed in.

Add a new Asynchronous message Interaction to the Pact

Returns an iterator over the asynchronous messages in the Pact

Create a new PactBuilder, specifying the names of the service consuming the API and the service providing it.

Create a new PactBuilder for a V4 specification Pact, specifying the names of the service consuming the API and the service providing it.

Start a mock server running in a background thread. If the catalog entry is omitted, then a standard HTTP mock server will be started.

Add a plugin to be used by the test. This requires the plugins feature.

Checks whether the given pact builder is using the V4 specification.

Functions

interaction(builder, description, interaction_type, build_fn)

@spec interaction(
  builder :: Pact.Native.PactConsumer.PactBuilder.t(),
  description :: String.t(),
  interaction_type :: String.t(),
  build_fn :: (interaction_builder ::
                 Pact.Native.PactConsumer.InteractionBuilder.t() ->
                 Pact.Native.PactConsumer.InteractionBuilder.t())
) :: Pact.Native.PactConsumer.PactBuilder.t()

Add a new HTTP Interaction to the Pact. Needs to return a clone of the builder that is passed in.

message_interaction(builder, description, build_fn)

Add a new Asynchronous message Interaction to the Pact

messages(builder)

Returns an iterator over the asynchronous messages in the Pact

new(consumer, provider)

@spec new(consumer :: String.t(), provider :: String.t()) ::
  Pact.Native.PactConsumer.PactBuilder.t()

Create a new PactBuilder, specifying the names of the service consuming the API and the service providing it.

new_v4(consumer, provider)

@spec new_v4(consumer :: String.t(), provider :: String.t()) ::
  Pact.Native.PactConsumer.PactBuilder.t()

Create a new PactBuilder for a V4 specification Pact, specifying the names of the service consuming the API and the service providing it.

start_mock_server(builder)

@spec start_mock_server(builder :: Pact.Native.PactConsumer.PactBuilder.t()) ::
  :ignore | {:error, any()} | {:ok, pid()}

Start a mock server running in a background thread. If the catalog entry is omitted, then a standard HTTP mock server will be started.

using_plugin(builder, name, version \\ nil)

@spec using_plugin(
  builder :: Pact.Native.PactConsumer.PactBuilder.t(),
  name :: String.t(),
  version :: String.t() | nil
) :: Pact.Native.PactConsumer.PactBuilder.t()

Add a plugin to be used by the test. This requires the plugins feature.

Panics: Plugins only work with V4 specification pacts. This method will panic if the pact being built is V3 format. Use PactBuilder::new_v4 to create a builder with a V4 format pact.

v4?(builder)

@spec v4?(builder :: Pact.Native.PactConsumer.PactBuilder.t()) :: bool()

Checks whether the given pact builder is using the V4 specification.