Sha256: 9483850395c11c76794d81f7d21dc26aae0fd723524249f84c6ba922aec37246

Contents?: true

Size: 727 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

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