pact-provider-verifier icon indicating copy to clipboard operation
pact-provider-verifier copied to clipboard

Implement ProviderState generator to allow injecting parameters to Interactions

Open hhhonzik opened this issue 5 years ago • 3 comments

pact-jvm supports injecting parameters to Interactions thanks to clever usage of generators and ProviderState parameters as described here:

  • consumer contract implementation: https://github.com/DiUS/pact-jvm/tree/master/provider/pact-jvm-provider-junit#returning-values-that-can-be-injected
  • provider state injection: https://github.com/DiUS/pact-jvm/tree/master/provider/pact-jvm-provider-junit#returning-values-that-can-be-injected

I would like to use Pact for our NodeJS provider, but this is a crucial feature and I am happy to work on a PR for this.

Is it possible to implement the generators with the same functionality as pact-jvm has it?

I think we'd just need to store the parameters we get from state preparation and implement proper generator.

hhhonzik avatar Feb 04 '20 16:02 hhhonzik

I'd be very happy for you to work on this @hhhonzik.

You'll need to coordinate development between the pact-provider-verifier and pact-ruby projects. To do this, check them both out side by side, and then set the environment variable X_PACT_DEVELOPMENT=true in the pact-provider-verifier project before running bundle. This will cause the local copy of pact-ruby to be used instead of the gem dependency.

bethesque avatar Feb 11 '20 00:02 bethesque

Hi, I am very keen to get this working, and will pick up where @hhhonzik left off if needed, looks like the pull requests were fairly far along?

slt avatar Sep 13 '22 06:09 slt

I have added the remaining generators and some tests to the pact-ruby project

https://github.com/pact-foundation/pact-ruby/pull/273

slt avatar Sep 15 '22 07:09 slt