Skip to content

Commit

Permalink
fix: pass through includePendingStatus to the 'pacts for verification…
Browse files Browse the repository at this point in the history
…' API when it is false
  • Loading branch information
bethesque committed Dec 16, 2021
1 parent 8e8bb22 commit f0e37a4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
17 changes: 17 additions & 0 deletions lib/pact/hash_refinements.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Pact
module HashRefinements
refine Hash do
def compact
h = {}
each do |key, value|
h[key] = value unless value == nil
end
h
end unless Hash.method_defined? :compact

def compact!
reject! {|_key, value| value == nil}
end unless Hash.method_defined? :compact!
end
end
end
11 changes: 7 additions & 4 deletions lib/pact/pact_broker/fetch_pact_uris_for_verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
require 'pact/pact_broker/fetch_pacts'
require 'pact/pact_broker/notices'
require 'pact/pact_broker/pact_selection_description'
require "pact/hash_refinements"

module Pact
module PactBroker
class FetchPactURIsForVerification
using Pact::HashRefinements

include PactSelectionDescription
attr_reader :provider, :consumer_version_selectors, :provider_version_branch, :provider_version_tags, :broker_base_url, :http_client_options, :http_client, :options

Expand Down Expand Up @@ -74,12 +77,12 @@ def pacts_for_verification_entity

def query
q = {}
q["includePendingStatus"] = true if options[:include_pending_status]
q["includePendingStatus"] = options[:include_pending_status]
q["consumerVersionSelectors"] = consumer_version_selectors if consumer_version_selectors.any?
q["providerVersionTags"] = provider_version_tags if provider_version_tags.any?
q["providerVersionBranch"] = provider_version_branch if provider_version_branch
q["includeWipPactsSince"] = options[:include_wip_pacts_since] if options[:include_wip_pacts_since]
q
q["providerVersionBranch"] = provider_version_branch
q["includeWipPactsSince"] = options[:include_wip_pacts_since]
q.compact
end

def extract_notices(pact)
Expand Down

0 comments on commit f0e37a4

Please sign in to comment.