Sha256: 5d2f55a802d5e9b8bdb109d6e871b5777bb0ace89293404d86c00cfec46e5cc2

Contents?: true

Size: 1018 Bytes

Versions: 17

Compression:

Stored size: 1018 Bytes

Contents

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

  let(:path) { "/pacts/provider/A%20Provider/consumer/A%20Consumer/version/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

17 entries across 17 versions & 1 rubygems

Version Path
pact_broker-1.15.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.14.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.13.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.12.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.11.2 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.11.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.11.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.10.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.9.3 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.9.2 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.9.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.9.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.9.0.rc1 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.8.1 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.8.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.7.0 spec/features/publish_not_a_pact_spec.rb
pact_broker-1.6.0 spec/features/publish_not_a_pact_spec.rb