Sha256: 31984f6059bf925d8a0607c001258b30b51518b6f286e8f235538f7a645e6662

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

describe "retrieving a pact" do

  subject { get path; last_response  }

  context "when differing case is used in the consumer and provider names" do

    let(:path) { "/pacts/provider/a%20provider/consumer/a%20consumer/version/1.2.3A" }

    before do
      TestDataBuilder.new.create_pact_with_hierarchy "A Consumer", "1.2.3a", "A Provider"
    end

    context "when case sensitivity is turned on" do
      before do
        allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
      end

      it "returns a 404 Not found" do
        expect(subject.status).to be 404
      end
    end

    context "when case sensitivity is turned off" do
      before do
        allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
      end

      it "returns a 200 Success" do
        expect(subject.status).to be 200
      end
    end
  end
  context "when differing case is used in the tag name" do

    let(:path) { "/pacts/provider/a%20provider/consumer/a%20consumer/latest/PROD" }

    before do
      TestDataBuilder.new
        .create_consumer("A Consumer")
        .create_consumer_version("1.2.3")
        .create_consumer_version_tag("prod")
        .create_provider("A Provider")
        .create_pact
    end

    context "when case sensitivity is turned on" do
      before do
        allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(true)
      end

      it "returns a 404 Not found" do
        expect(subject.status).to be 404
      end
    end

    context "when case sensitivity is turned off" do
      before do
        allow(PactBroker.configuration).to receive(:use_case_sensitive_resource_names).and_return(false)
      end

      it "returns a 200 Success" do
        expect(subject.status).to be 200
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pact_broker-2.4.2 spec/features/get_pact_spec.rb
pact_broker-2.4.1 spec/features/get_pact_spec.rb
pact_broker-2.4.0 spec/features/get_pact_spec.rb
pact_broker-2.3.0 spec/features/get_pact_spec.rb
pact_broker-2.2.0 spec/features/get_pact_spec.rb
pact_broker-2.1.1 spec/features/get_pact_spec.rb
pact_broker-2.1.0 spec/features/get_pact_spec.rb