Skip to content

Commit

Permalink
feat: add support for include_wip_pacts_since
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Sep 12, 2020
1 parent 31d114f commit f2247b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ class PactVerificationFromBroker
# in parent scope, it will clash with these ones,
# so put an underscore in front of the name to be safer.

attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_verbose
attr_accessor :_provider_name, :_pact_broker_base_url, :_consumer_version_tags, :_provider_version_tags, :_basic_auth_options, :_enable_pending, :_include_wip_pacts_since, :_verbose

def initialize(provider_name, provider_version_tags)
@_provider_name = provider_name
@_provider_version_tags = provider_version_tags
@_consumer_version_tags = []
@_enable_pending = false
@_include_wip_pacts_since = nil
@_verbose = false
end

Expand All @@ -38,6 +39,10 @@ def enable_pending enable_pending
self._enable_pending = enable_pending
end

def include_wip_pacts_since since
self._include_wip_pacts_since = since
end

def verbose verbose
self._verbose = verbose
end
Expand All @@ -57,7 +62,7 @@ def create_pact_verification
_provider_version_tags,
_pact_broker_base_url,
_basic_auth_options.merge(verbose: _verbose),
{ include_pending_status: _enable_pending }
{ include_pending_status: _enable_pending, include_wip_pacts_since: _include_wip_pacts_since }
)

Pact.provider_world.add_pact_uri_source fetch_pacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,24 @@ module Configuration
pact_broker_base_url base_url, basic_auth_options
consumer_version_tags tags
enable_pending true
include_wip_pacts_since "2020-01-01"
verbose true
end
end

let(:fetch_pacts) { double('FetchPacts') }
let(:basic_auth_opts) { basic_auth_options.merge(verbose: true) }
let(:options) { { include_pending_status: true }}
let(:options) { { include_pending_status: true, include_wip_pacts_since: "2020-01-01" }}
let(:consumer_version_selectors) { [ { tag: 'master', latest: true }] }

it "creates a instance of Pact::PactBroker::FetchPactURIsForVerification" do
expect(Pact::PactBroker::FetchPactURIsForVerification).to receive(:new).with(provider_name, consumer_version_selectors, provider_version_tags, base_url, basic_auth_opts, options)
expect(Pact::PactBroker::FetchPactURIsForVerification).to receive(:new).with(
provider_name,
consumer_version_selectors,
provider_version_tags,
base_url,
basic_auth_opts,
options)
subject
end

Expand Down

0 comments on commit f2247b8

Please sign in to comment.