Sha256: 4264c6cc80759f97a095641ee748305f54bf503df2d392c3a3588c686e2917d6

Contents?: true

Size: 1.36 KB

Versions: 81

Compression:

Stored size: 1.36 KB

Contents

require 'pact_broker/client/pacts/list_latest_versions'

module PactBroker::Client
  describe Pacts::ListLatestVersions, :pact => true do

    let(:pact_broker_client) { PactBrokerClient.new(base_url: 'http://localhost:1234') }

    describe "listing pacts" do
      context "when pacts exist" do
        let(:response_body) { JSON.parse(File.read("./spec/support/pacts_latest_list.json"))}
        let(:expected_pacts) do
          [{
            :consumer => {
              :name => 'Condor',
              :version => {
                :number => '1.3.0'
              }
            },
            :provider => {
                :name => 'Pricing Service'
              }
            }
          ]
        end
        before do
          pact_broker.
          given("a pact between Condor and the Pricing Service exists").
          upon_receiving("a request to list the latest pacts").
          with(
              method: :get,
              path: '/pacts/latest',
              headers: {} ).
            will_respond_with( headers: {'Content-Type' => Pact.term(generate: 'application/hal+json', matcher: %r{application/hal\+json})},
              status: 200,
              body: response_body
            )
        end
        it "returns the response body" do
            expect(pact_broker_client.pacts.list_latest).to eq(expected_pacts)
        end
      end
    end
  end
end

Version data entries

81 entries across 81 versions & 1 rubygems

Version Path
pact_broker-client-1.75.3 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.75.1 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.75.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.74.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.73.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.72.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.71.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.70.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.69.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.68.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.67.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.66.1 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.66.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.65.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.64.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.63.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.62.1 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.62.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.61.1 spec/service_providers/list_latest_pact_versions_spec.rb.bak
pact_broker-client-1.61.0 spec/service_providers/list_latest_pact_versions_spec.rb.bak