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.32.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.31.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.30.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.29.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.28.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.28.0.rc1 lib/pact/consumer/configuration/service_provider.rb
pact-1.27.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.26.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.25.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.24.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.23.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.22.2 lib/pact/consumer/configuration/service_provider.rb
pact-1.22.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.21.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.20.1 lib/pact/consumer/configuration/service_provider.rb
pact-1.20.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.19.2 lib/pact/consumer/configuration/service_provider.rb
pact-1.19.1 lib/pact/consumer/configuration/service_provider.rb
pact-1.19.0 lib/pact/consumer/configuration/service_provider.rb
pact-1.18.0 lib/pact/consumer/configuration/service_provider.rb