Sha256: 5b214351b46fa79e8f3e98793f2228cf140528d5a1653a13f9500a35103cea02

Contents?: true

Size: 1.83 KB

Versions: 20

Compression:

Stored size: 1.83 KB

Contents

describe "retrieving a pact" do
  subject { get(path)  }

  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").and_return(: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

  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

20 entries across 20 versions & 1 rubygems

Version Path
pact_broker-2.85.1 spec/features/get_pact_spec.rb
pact_broker-2.85.0 spec/features/get_pact_spec.rb
pact_broker-2.84.0 spec/features/get_pact_spec.rb
pact_broker-2.83.0 spec/features/get_pact_spec.rb
pact_broker-2.82.0 spec/features/get_pact_spec.rb
pact_broker-2.81.0 spec/features/get_pact_spec.rb
pact_broker-2.80.0 spec/features/get_pact_spec.rb
pact_broker-2.79.1 spec/features/get_pact_spec.rb
pact_broker-2.79.0 spec/features/get_pact_spec.rb
pact_broker-2.78.1 spec/features/get_pact_spec.rb
pact_broker-2.78.0 spec/features/get_pact_spec.rb
pact_broker-2.77.0 spec/features/get_pact_spec.rb
pact_broker-2.76.2 spec/features/get_pact_spec.rb
pact_broker-2.76.1 spec/features/get_pact_spec.rb
pact_broker-2.76.0 spec/features/get_pact_spec.rb
pact_broker-2.75.0 spec/features/get_pact_spec.rb
pact_broker-2.74.1 spec/features/get_pact_spec.rb
pact_broker-2.74.0 spec/features/get_pact_spec.rb
pact_broker-2.73.0 spec/features/get_pact_spec.rb
pact_broker-2.72.0 spec/features/get_pact_spec.rb