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

feat(Link.put!): add a Link.put! method #297

Closed id-ilych closed 1 year ago

id-ilych commented 1 year ago

The Link has get! and post! shorthand methods that do assert_success! on the result. This PR adds missing put! shorthand.

Should I also update these lines to use get!?

bethesque commented 1 year ago

Sure, thank you. Is the put ever used?

id-ilych commented 1 year ago

Hey @bethesque :wave:

Yes, it seems so:

bethesque commented 1 year ago

Just checking in on open PRs. I'm happy to merge this, but there's no point unless the method is actually called, so to make it worth merging, the places that call put.assert_success! should be updated at the same time.

id-ilych commented 1 year ago

Hey @bethesque :wave:

In the pact-ruby code base it is of no use, since both usages raise custom errors instead of the standard one.

But the method is used in our custom extension (formatter). Of course I can just monkey-patch it but not sure I understand why not to add banged version for put method when all the other methods have it already. At least for the sake of symmetry.

But if there is a policy to only have methods directly used in the repo, then ok, please close the PR in that case.

bethesque commented 1 year ago

If it's not used locally, it might get deleted. Just monkey patch the class, imo ;)