Sha256: 2c09aa5572922c6aec6bf203254660c391ce7436f7fd2039a5a573e616fd21f4

Contents?: true

Size: 771 Bytes

Versions: 7

Compression:

Stored size: 771 Bytes

Contents

describe "Deleting a pact" do

  let(:pact_content) { load_fixture('a_consumer-a_provider.json') }
  let(:path) { "/pacts/provider/A%20Provider/consumer/A%20Consumer/version/1.2.3" }
  let(:response_body_json) { JSON.parse(subject.body) }

  subject { delete path; last_response  }

  context "when the pact exists" do
    before do
      TestDataBuilder.new.create_pact_with_hierarchy "A Consumer", "1.2.3", "A Provider"
    end

    it "deletes the pact" do
      expect{ subject }.to change{ PactBroker::Pacts::PactPublication.count }.by(-1)
    end

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

  context "when the pact does not exist" do
    it "returns a 404 Not Found" do
      expect(subject.status).to be 404
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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