pact-foundation / pact-mock_service

Provides a mock service for use with Pact

Home Page:https://pact.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pactfile_write_mode - "usage" text is missing the option to 'update'

andreasmarkussen opened this issue · comments

Though this is minor, it still is something that could give issues for newbies like me.

When reading the source code of interactions/interactions_filter.rb the pactfile_write_mode has 3 options, but when reading the "Options:" description and the Readme.md documentation that refers to the options documentation, then only two are described.

The 3 options from the source code are

# When running in pactfile_write_mode :overwrite, all interactions are cleared from the
# pact file, and all new interactions should be distinct (unique description and provider state).
# When running in pactfile_write_mode :update, an interaction with the same description
# and provider state as an existing one will just overwrite that one interaction.
# When running in pactfile_write_mode :merge, an interaction with the same description and provider
# state must be identical to the existing one, otherwise an exception will be raised.

The content from the "Usage:" section is (newlines added for readability)

PACT_FILE_WRITE_MODE_DESC = "`overwrite` or `merge`. 
        Use `merge` when running multiple mock service instances in parallel
        for the same consumer/provider pair." 
+   " Ensure the pact file is deleted before running tests when using 
        this option so that interactions deleted from the code are not maintained in the file."

(yes and code are should be code is ... at least according to Grammarly)

I am not strong enough in either Ruby or the real meaning of the Write Mode to suggest what it really should be and just to the PR, however, inputs to a better "Usage:" are welcome, and then I could perhaps update at least the readme and the usage.

The update option was only really added as an internal hack because we had a long running pact test suite and I didn't want to run the whole thing each time, so I added an update option, never really intending it to be public. Are you using it?

Closing due to inactivity.