pact_erlang version 0.2.0 released with the new ma...
# pact-beam
s
pact_erlang version 0.2.0 released with the new map-based DSL: https://github.com/greyorange-labs/pact_erlang Sample usage:
Copy code
PactRef = pact:v4(<<"myapp">>, <<"animal_service">>),
AnimalObject = #{<<"name">> => <<"Mary">>, <<"type">> => <<"alligator">>},
{ok, Port} = pact:interaction(PactRef,
#{
    given => <<"an alligator with the name Mary exists">>,
    upon_receiving => <<"a request to GET an animal: Mary">>,
    with_request => #{
        method => <<"GET">>,
        path => <<"/animals/Mary">>
    },
    will_respond_with => #{
        status => 200,
        headers => #{
            <<"Content-Type">> => <<"application/json">>
        },
        body => thoas:encode(AnimalObject)
    }
}),
?assertMatch({ok, AnimalObject}, animal_service_interface:get_animal(Port, "Mary")),
{ok, matched} = pact:verify(PactRef),
pact:write(PactRef, <<"./pacts">>),
pact:cleanup(PactRef).
🌮 1
🎉 4
p
Thanks @Srijan Choudhary for all the help, this is awesome ! 🌮 for you..
🌮 1
1000000 1
y
Nice stuff fella! Will make sure we get this in this months pact blog!