class Pact::Consumer::Configuration::ServiceConsumer

Attributes

app[RW]
name[RW]
port[RW]

Public Class Methods

new(name) click to toggle source
# File lib/pact/consumer/configuration/service_consumer.rb, line 12
def initialize name
  @name = name
  @app = nil
  @port = nil
end

Public Instance Methods

finalize() click to toggle source
# File lib/pact/consumer/configuration/service_consumer.rb, line 32
def finalize
  validate
  register_consumer_app if @app
end
has_pact_with(service_provider_name, &block) click to toggle source
# File lib/pact/consumer/configuration/service_consumer.rb, line 27
def has_pact_with service_provider_name, &block
  ServiceProvider.build(service_provider_name, name, &block)
end

Private Instance Methods

register_consumer_app() click to toggle source
# File lib/pact/consumer/configuration/service_consumer.rb, line 45
def register_consumer_app
  Pact::MockService::AppManager.instance.register app, port
end
validate() click to toggle source
# File lib/pact/consumer/configuration/service_consumer.rb, line 39
def validate
  raise "Please provide a consumer name" unless (name && !name.empty?)
  raise "Please provide a port for the consumer app" if app && !port
end