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.79.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.79.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.78.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.78.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.77.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.76.2 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.76.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.76.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.75.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.74.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.74.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.73.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.72.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.71.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.70.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.69.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.68.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.68.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.67.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-2.66.0 spec/features/publish_not_a_pact_spec.rb