Sha256: b2df4a7433a63225e1f0dad0ccf8d8bb0f152cf792ac7a451f57a4d3d6dff46d

Contents?: true

Size: 1.51 KB

Versions: 6

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'
require 'pact_broker/messages'

module PactBroker
  module Messages


    describe "#potential_duplicate_pacticipant_message" do
      let(:new_name) { 'Contracts' }
      let(:fred) { double('Contracts Service', name: 'Contracts Service') }
      let(:frederich) { double('Accepted Contracts', name: 'Accepted Contracts') }
      let(:potential_duplicate_pacticipants) { [fred, frederich]}

      let(:expected_message) { String.new <<-EOS
This is the first time a pact has been published for "Contracts".
The name "Contracts" is very similar to the following existing consumers/providers:
* Contracts Service
* Accepted Contracts
If you meant to specify one of the above names, please correct the pact configuration, and re-publish the pact.
If the pact is intended to be for a new consumer or provider, please manually create "Contracts" using the following command, and then re-publish the pact:
$ curl -v -XPOST -H "Content-Type: application/json" -d "{\\\"name\\\": \\\"Contracts\\\"}" http://example.org/pacticipants
If the pact broker requires authentication, include the '-u' flag with the proper credentials:
$ curl -v -XPOST -u <username>:<password> -H "Content-Type: application/json" -d "{\\\"name\\\": \\\"Contracts\\\"}" http://example.org/pacticipants
EOS
      }
      subject { Messages.potential_duplicate_pacticipant_message new_name, potential_duplicate_pacticipants, 'http://example.org' }

      it "returns a message" do
        expect(subject).to eq expected_message
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-2.5.1 spec/lib/pact_broker/messages_spec.rb
pact_broker-2.5.0 spec/lib/pact_broker/messages_spec.rb
pact_broker-2.4.2 spec/lib/pact_broker/messages_spec.rb
pact_broker-2.4.1 spec/lib/pact_broker/messages_spec.rb
pact_broker-2.4.0 spec/lib/pact_broker/messages_spec.rb
pact_broker-2.3.0 spec/lib/pact_broker/messages_spec.rb