Sha256: 8c099dfecf75efa603a5b5555149ada11f1da8bc48b6b45cc36c5fc11afbc29f

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

module Pact
  module Messages
    module Consumer
      module DSL
        class MessageConsumer
          extend Pact::DSL

          attr_accessor :consumer_name

          def initialize(consumer_name)
            @consumer_name = consumer_name
          end

          dsl do
            def has_pact_with(provider_name, &block) # rubocop:disable Style/PredicateName
              MessageProvider.build(provider_name, consumer_name, &block)
            end
          end

          def finalize
            validate
          end

          private

          def validate
            fail 'Please provide a consumer name' unless consumer_name && !consumer_name.empty?
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact-messages-0.1.1 lib/pact/messages/consumer/dsl/message_consumer.rb
pact-messages-0.1.0 lib/pact/messages/consumer/dsl/message_consumer.rb