We are working with Ruby on Rails. We implemented Pact until the
Gold level.
The questions are:
โข We are using the
webmock gem (see
Comparisons with other tools) in our unit tests. We chose an existing HTTP client (on the consumer side) to be validated with Pact. We made a copy of that client to point it to the Pact mock service, and we could successfully generate the Pact file and validate the provider. The pro is that we didn't change the existing code, and the con is that we need to maintain two mock definitions: one for Pact and one for webmock. What is the best practice here? Should we replace every HTTP client occurrence?
โข When we want to generate a Pact file, we need to define the request body/response body/headers, create a spec, and finally to execute the code. That's fine. The thing is that we need to code trivial expectations (
according to the documentation) too. I understand the expectation on functional tests. But in these cases, there is no complex logic in the middle. We are testing the Pact tool itself. What is the purpose creating expectations of something we defined a few lines above?