Sha256: 6e26a6e0cf39f4139fba1da4760387c9e158e767969ab8e72332b7f90cdebdf7

Contents?: true

Size: 1019 Bytes

Versions: 139

Compression:

Stored size: 1019 Bytes

Contents

describe "Publishing a contract that is not a pact" do

  let(:path) { "/pacts/provider/A%20Provider/consumer/A%20Consumer/versions/1.2.3" }
  let(:parsed_response_body) { JSON.parse(subject.body) }

  subject { put path, pact_content, {'CONTENT_TYPE' => 'application/json' }; last_response  }

  context "when the pact is another type of CDC that doesn't have the Consumer or Provider names in the expected places" do
    let(:pact_content) { {a: 'not pact'}.to_json }

    it "accepts the un-pact Pact" do
      expect(subject.status).to be 201
    end

    it "returns the content" do
      expect(parsed_response_body).to include 'a' => 'not pact'
    end

    it "returns _links" do
      expect(parsed_response_body).to have_key '_links'
    end
  end

  context "when the content is an array" do

    let(:pact_content) { '[1]' }

    it "accepts the un-pact Pact" do
      expect(subject.status).to be 201
    end

    it "returns the content" do
      expect(parsed_response_body).to eq [1]
    end

  end
end

Version data entries

139 entries across 139 versions & 1 rubygems

Version Path
pact_broker-2.65.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.64.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.63.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.62.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.61.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.60.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.60.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.59.2 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.59.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.59.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.58.3 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.58.2 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.58.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.57.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.56.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.56.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.55.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.54.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.53.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.52.2 spec/features/publish_not_a_pact_spec.rb