From f2247b80b330d3d05294c26c135fe91425fcd27a Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sat, 12 Sep 2020 11:38:18 +1000 Subject: [PATCH] feat: add support for include_wip_pacts_since --- .../configuration/pact_verification_from_broker.rb | 9 +++++++-- .../pact_verification_from_broker_spec.rb | 11 +++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/pact/provider/configuration/pact_verification_from_broker.rb b/lib/pact/provider/configuration/pact_verification_from_broker.rb index 35636f23..6275ec89 100644 --- a/lib/pact/provider/configuration/pact_verification_from_broker.rb +++ b/lib/pact/provider/configuration/pact_verification_from_broker.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/lib/pact/provider/configuration/pact_verification_from_broker_spec.rb b/spec/lib/pact/provider/configuration/pact_verification_from_broker_spec.rb index 64ba35c1..1500332b 100644 --- a/spec/lib/pact/provider/configuration/pact_verification_from_broker_spec.rb +++ b/spec/lib/pact/provider/configuration/pact_verification_from_broker_spec.rb @@ -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