Skip to content

Commit

Permalink
feat: allow include_wip_pacts_since to use a Date, DateTime or Time
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Sep 12, 2020
1 parent f2247b8 commit dd35366
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def enable_pending enable_pending
end

def include_wip_pacts_since since
self._include_wip_pacts_since = since
self._include_wip_pacts_since = if since.respond_to?(:xmlschema)
since.xmlschema
else
since
end
end

def verbose verbose
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Configuration
let(:provider_name) {'provider-name'}
let(:provider_version_tags) { ['master'] }
let(:base_url) { "http://broker.org" }
let(:since) { "2020-01-01" }
let(:basic_auth_options) do
{
username: 'pact_broker_username',
Expand All @@ -27,7 +28,7 @@ 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"
include_wip_pacts_since since
verbose true
end
end
Expand All @@ -44,14 +45,34 @@ module Configuration
provider_version_tags,
base_url,
basic_auth_opts,
options)
options
)
subject
end

it "adds a pact_uri_source to the provider world" do
expect(Pact.provider_world).to receive(:add_pact_uri_source).with(fetch_pacts)
subject
end

context "when since is a Date" do
let(:since) { Date.new(2020, 1, 1) }

it "converts it to a string" do
expect(Pact::PactBroker::FetchPactURIsForVerification).to receive(:new).with(
anything,
anything,
anything,
anything,
anything,
{
include_pending_status: true,
include_wip_pacts_since: since.xmlschema
}
)
subject
end
end
end

context "with a missing base url" do
Expand Down

0 comments on commit dd35366

Please sign in to comment.