Sha256: 857ade7cbc59daca3de9678f47629f61375c48d369ec4adad94b7892256091bd

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

describe "Deleting a pact" do

  let(:pact_content) { load_fixture('consumer-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
      ProviderStateBuilder.new.create_pact_with_hierarchy "A Consumer", "1.2.3", "A Provider"
    end

    it "deletes the pact" do
      expect{ subject }.to change{ PactBroker::Pacts::DatabaseModel.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

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-1.3.2.rc1 spec/features/delete_pact_spec.rb