Skip to content

Commit b152bc7

Browse files
committed
test: add tests for Pact::PactBroker fetch pact uris
1 parent 1aa1989 commit b152bc7

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

lib/pact/pact_broker.rb

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require 'pact/pact_broker/fetch_pacts'
22
require 'pact/pact_broker/fetch_wip_pacts'
33

4+
#
5+
# @public Use by Pact Provider Verifier
6+
#
47
module Pact
58
module PactBroker
69
extend self

spec/lib/pact/pact_broker_spec.rb

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
require 'pact/pact_broker'
2+
require 'pact/provider/pact_uri'
3+
4+
module Pact
5+
module PactBroker
6+
describe ".fetch_pact_uris" do
7+
before do
8+
allow(Pact::PactBroker::FetchPacts).to receive(:call).and_return([pact_uri])
9+
end
10+
11+
let(:pact_uri) { Pact::Provider::PactURI.new("http://pact") }
12+
13+
subject { Pact::PactBroker.fetch_pact_uris("foo") }
14+
15+
it "calls Pact::PactBroker::FetchPacts" do
16+
expect(Pact::PactBroker::FetchPacts).to receive(:call).with("foo")
17+
subject
18+
end
19+
20+
it "returns a list of string URLs" do
21+
expect(subject).to eq ["http://pact"]
22+
end
23+
end
24+
25+
describe ".fetch_wip_pact_uris" do
26+
before do
27+
allow(Pact::PactBroker::FetchWipPacts).to receive(:call).and_return([pact_uri])
28+
end
29+
30+
let(:pact_uri) { Pact::Provider::PactURI.new("http://pact") }
31+
32+
subject { Pact::PactBroker.fetch_wip_pact_uris("foo") }
33+
34+
it "calls Pact::PactBroker::FetchWipPacts" do
35+
expect(Pact::PactBroker::FetchWipPacts).to receive(:call).with("foo")
36+
subject
37+
end
38+
39+
it "returns a list of string URLs" do
40+
expect(subject).to eq ["http://pact"]
41+
end
42+
end
43+
end
44+
end

0 commit comments

Comments
 (0)