Sha256: b3dcdcf0993249b7b7461cea6d54acdda8d85fd85d2a9d7c7a94cafa58610229

Contents?: true

Size: 760 Bytes

Versions: 118

Compression:

Stored size: 760 Bytes

Contents

require 'pact/shared/dsl'
require 'pact/consumer/configuration/mock_service'

module Pact
  module Consumer
    module Configuration
      class ServiceProvider

        extend Pact::DSL

        attr_accessor :service, :consumer_name, :name

        def initialize name, consumer_name
          @name = name
          @service = nil
          @consumer_name = consumer_name
        end

        dsl do
          def mock_service name, &block
            self.service = MockService.build(name, consumer_name, self.name, &block)
          end
        end

        def finalize
          validate
        end

        private

        def validate
          raise "Please configure a service for #{name}" unless service
        end

      end

    end
  end

end

Version data entries

118 entries across 118 versions & 1 rubygems

Version Path
pact-1.66.1 lib/pact/consumer/configuration/service_provider.rb
pact-1.66.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.65.3 lib/pact/consumer/configuration/service_provider.rb
pact-1.65.2 lib/pact/consumer/configuration/service_provider.rb
pact-1.65.1 lib/pact/consumer/configuration/service_provider.rb
pact-1.65.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.64.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.63.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.62.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.61.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.60.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.59.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.58.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.57.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.56.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.55.7 lib/pact/consumer/configuration/service_provider.rb
pact-1.55.6 lib/pact/consumer/configuration/service_provider.rb
pact-1.55.5 lib/pact/consumer/configuration/service_provider.rb
pact-1.55.4 lib/pact/consumer/configuration/service_provider.rb
pact-1.55.3 lib/pact/consumer/configuration/service_provider.rb