Skip to content

Commit

Permalink
reactor: rename update_pact method
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Sep 28, 2021
1 parent b97ba84 commit 3083561
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/pact_broker/pacts/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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])
Expand All @@ -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}}"
Expand Down

0 comments on commit 3083561

Please sign in to comment.