Sha256: 74bbd58a36e9cdb86898fa82c96ce41f4bfbec8f5629eda34430c18b0ff397e8

Contents?: true

Size: 1.93 KB

Versions: 12

Compression:

Stored size: 1.93 KB

Contents

require "spec/support/test_data_builder"

describe "Get latest verification for pact" do
  before do
    td
      .create_consumer("Consumer")
      .create_consumer_version("1.2.3")
      .create_consumer_version_tag("master")
      .create_provider("Another provider")
      .create_pact
      .create_verification(number: 1, provider_version: "5")
      .create_provider("Provider")
      .create_pact
      .create_verification(number: 1, provider_version: "3")
      .create_verification(number: 2, provider_version: "4")
  end

  let(:last_response_body) { JSON.parse(subject.body, symbolize_names: true) }
  let(:content_type) { "application/vnd.pactbrokerextended.v1+json" }

  subject { get(path, nil, "HTTP_ACCEPT" => content_type) }

  context "by pact version" do
    let!(:path) { "/pacts/provider/Provider/consumer/Consumer/pact-version/#{td.pact.pact_version_sha}/verification-results/latest" }

    it "returns a 200 OK" do
      expect(subject.status).to eq 200
      expect(subject.headers["Content-Type"]).to include content_type
    end

    it "returns the verification" do
      expect(last_response_body[:providerApplicationVersion]).to eq "4"
    end
  end

  context "by consumer version" do
    let(:path) { "/pacts/provider/Provider/consumer/Consumer/version/1.2.3/verification-results/latest" }

    it "returns the verification" do
      expect(last_response_body[:providerApplicationVersion]).to eq "4"
    end
  end

  context "for latest pact" do
    let(:path) { "/pacts/provider/Provider/consumer/Consumer/latest/verification-results/latest" }

    it "returns the verification" do
      expect(last_response_body[:providerApplicationVersion]).to eq "4"
    end
  end

  context "for latest pact for tag" do
    let(:path) { "/pacts/provider/Provider/consumer/Consumer/latest/master/verification-results/latest" }

    it "returns the verification" do
      expect(last_response_body[:providerApplicationVersion]).to eq "4"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.89.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.88.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.87.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.86.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.85.1 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.85.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.84.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.83.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.82.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.81.0 spec/features/get_latest_verification_for_pact_spec.rb
pact_broker-2.80.0 spec/features/get_latest_verification_for_pact_spec.rb