pact-foundation / pact-ruby

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
2.17k stars 216 forks source link

Pact v4 specification implementation for Pact Ruby #267

Closed ThomasKoppensteiner closed 3 months ago

ThomasKoppensteiner commented 2 years ago

Please implement the pact v4 specification for Ruby (MRI and JRuby).

This ticket is a starting point. Please feel free to convert it to a GitHub project or a milestone.

mscottford commented 5 months ago

If this isn't the best place for me to ask my questions about implementing v3/v4 then please direct me to somewhere more appropriate.

Is the sample Ruby spec in the pact-reference repository a viable starting point for someone looking to experiment with creating an implementation of v3 and v4 in Ruby? I'm specifically thinking about the pact_mockserver_mk2 gem which doesn't appear to be published to RubyGems, but is used by the example consumer spec.

It does look like this example was authored quite a while ago, and it hasn't seen many changes since. There's also at least one test that appears to just be a stub and probably should be removed.

I'm interested in Ruby support Pact v3 and v4, because I've been using the Aruba gem to write Cucumber/Gherkin behavior tests for a series of command line executables that interact with some APIs that I also control. I want to be able to use the consumer tests to validate that the API behaves correctly. My research has not uncovered another tool that facilitates testing command line applications via Cucumber/Gherkin at the same level of quality that Aruba does, so using one of the implementations that already supports v3/v4 does not appear to be an option for me.

To that end, I'm interested in helping bring support for v3/v4 to Ruby. I've seen mentions in other issues that there are others who are also working on this effort. What's the best way for me to get involved?

/cc This question also applies to #266, so I'm linking to that issue from here. I suspect that adopting pact-ffi would result in both versions getting added without too much additional effort.

YOU54F commented 3 months ago

Is the sample Ruby spec in the pact-reference repository a viable starting point for someone looking to experiment with creating an implementation of v3 and v4 in Ruby? I'm specifically thinking about the pact_mockserver_mk2 gem which doesn't appear to be published to RubyGems, but is used by the example consumer spec.

No unfortunately, it is built with helix, which was archived

https://github.com/pact-foundation/pact-reference/blob/efc54d263e7ea53c9511cf389870e790c0158bc3/ruby/pact_mockserver_mk2/pact_mockserver_mk2.gemspec

I suspect that adopting pact-ffi would result in both versions getting added without too much additional effort.

Correct, I've already built a library wrapper example for the pact_ffi library, along with some examples

https://github.com/YOU54F/pact-ruby-ffi

we do have a cucumber based pact-compatibility-suite for validating client implementations.

I would assume the best path forward is trying to integrate the pact_ffi functions via the pact-ruby-ffi wrapper for at least V2.

API's could then be proposed for V3/V4.

One consideration may be to consolidate the ruby project into a single gem, as currently the makeup of the pact-ruby project consists of several independent gems. As the pact_ffi shared library contains all the functionality provided by each indy gem

https://docs.pact.io/diagrams/ecosystem#ruby-goldberg-machine

YOU54F commented 3 months ago

closing in favour of #319, as it will be easier for me to track

thanks for raising