From 3083561c88aeaab751ab0740ded9e17e580b787d Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 28 Sep 2021 13:39:25 +1000 Subject: [PATCH] reactor: rename update_pact method --- lib/pact_broker/pacts/service.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pact_broker/pacts/service.rb b/lib/pact_broker/pacts/service.rb index e13445132..7541995ad 100644 --- a/lib/pact_broker/pacts/service.rb +++ b/lib/pact_broker/pacts/service.rb @@ -56,7 +56,7 @@ def create_or_update_pact params existing_pact = pact_repository.find_by_version_and_provider(consumer_version.id, provider.id) if existing_pact - update_pact params, existing_pact + create_pact_revision params, existing_pact else create_pact params, consumer_version, provider end @@ -72,7 +72,7 @@ def merge_pact params existing_pact.json_content, params[:json_content] ) - update_pact params, existing_pact + create_pact_revision params, existing_pact end def find_all_pact_versions_between consumer, options @@ -155,7 +155,7 @@ def find_for_verification_publication(pact_params, consumer_version_selector_has end # Overwriting an existing pact with the same consumer/provider/consumer version number - def update_pact params, existing_pact + def create_pact_revision params, existing_pact logger.info "Updating existing pact publication with params #{params.reject{ |k, _v| k == :json_content}}" logger.debug "Content #{params[:json_content]}" pact_version_sha = generate_sha(params[:json_content]) @@ -177,12 +177,12 @@ def update_pact params, existing_pact updated_pact end + private :create_pact_revision + def disallowed_modification?(existing_pact, new_json_content) !PactBroker.configuration.allow_dangerous_contract_modification && existing_pact && existing_pact.pact_version_sha != generate_sha(new_json_content) end - private :update_pact - # When no publication for the given consumer/provider/consumer version number exists def create_pact params, version, provider logger.info "Creating new pact publication with params #{params.reject{ |k, _v| k == :json_content}}"