Sha256: 37b730cfe0aa26ec79906055c8a2bf97a9d0f0998f424117a00e97c3661671cd

Contents?: true

Size: 810 Bytes

Versions: 3

Compression:

Stored size: 810 Bytes

Contents

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

          attr_accessor :service, :consumer_name, :provider_name

          def initialize(provider_name, consumer_name)
            @provider_name = provider_name
            @consumer_name = consumer_name
            @service       = nil
          end

          dsl do
            def mock_service(name, &block)
              self.service = MockService.build(name, consumer_name, provider_name, &block || proc {})
            end
          end

          def finalize
            validate
          end

          private

          def validate
            fail "Please configure a service for #{provider_name}" unless service
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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