I have a ruby pact mock service provider that captures my request. I would like to extract the exact value provided in the request (which was matched by a Pact.term / Pact.like), to do further processing with that value once the request has been answered by the pact service provider.
An example: a password reset functionality. Code makes an API call to a mailing service, providing the password reset link as parameter. Pact captures the request and mocks it successfully, validating the data. I pass the reset_link as one of the parameters (a Json body). This gets match in a Pact.term. All good. But I also want to recover the exact value that was used in the request (say reset_link: 'http://sample.com/reset-password?key=12345'), so I can make a subsequent request and check that exact link does indeed allow a successful password reset.
Now, if I was sending email directly, it is easy to do, I can just parse Mail::TestMailer.deliveries.last
How can I do this?
I've gone through the code, even creating a Pact::SomethingLike subclass wouldn't work, as the comparison method is a lovely functional programming module, not a method in the class.
Is there a before / after hook, or a way to grab the whole web request?
PS: I'm aware this is typically tested by the underlying library I use. The library sanctioned way of adjusting functionality is to override certain methods, I need to re-test the whole functionality.
PPS: this is not rails but roda.
Thanks André