Skip to content

Commit

Permalink
test: add tests for Pact::PactBroker fetch pact uris
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jul 24, 2018
1 parent 1aa1989 commit b152bc7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/pact/pact_broker.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'pact/pact_broker/fetch_pacts'
require 'pact/pact_broker/fetch_wip_pacts'

#
# @public Use by Pact Provider Verifier
#
module Pact
module PactBroker
extend self
Expand Down
44 changes: 44 additions & 0 deletions spec/lib/pact/pact_broker_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require 'pact/pact_broker'
require 'pact/provider/pact_uri'

module Pact
module PactBroker
describe ".fetch_pact_uris" do
before do
allow(Pact::PactBroker::FetchPacts).to receive(:call).and_return([pact_uri])
end

let(:pact_uri) { Pact::Provider::PactURI.new("http://pact") }

subject { Pact::PactBroker.fetch_pact_uris("foo") }

it "calls Pact::PactBroker::FetchPacts" do
expect(Pact::PactBroker::FetchPacts).to receive(:call).with("foo")
subject
end

it "returns a list of string URLs" do
expect(subject).to eq ["http://pact"]
end
end

describe ".fetch_wip_pact_uris" do
before do
allow(Pact::PactBroker::FetchWipPacts).to receive(:call).and_return([pact_uri])
end

let(:pact_uri) { Pact::Provider::PactURI.new("http://pact") }

subject { Pact::PactBroker.fetch_wip_pact_uris("foo") }

it "calls Pact::PactBroker::FetchWipPacts" do
expect(Pact::PactBroker::FetchWipPacts).to receive(:call).with("foo")
subject
end

it "returns a list of string URLs" do
expect(subject).to eq ["http://pact"]
end
end
end
end

0 comments on commit b152bc7

Please sign in to comment.