Class: Pact::MockService::Spawn

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/mock_service/spawn.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consumer, provider, host, port, options) ⇒ Spawn

Returns a new instance of Spawn.



17
18
19
20
21
22
23
# File 'lib/pact/mock_service/spawn.rb', line 17

def initialize consumer, provider, host, port, options
  @consumer = consumer
  @provider = provider
  @host = host
  @port = port
  @options = options
end

Instance Attribute Details

#consumerObject (readonly)

Returns the value of attribute consumer.



15
16
17
# File 'lib/pact/mock_service/spawn.rb', line 15

def consumer
  @consumer
end

#hostObject (readonly)

Returns the value of attribute host.



15
16
17
# File 'lib/pact/mock_service/spawn.rb', line 15

def host
  @host
end

#optionsObject (readonly)

Returns the value of attribute options.



15
16
17
# File 'lib/pact/mock_service/spawn.rb', line 15

def options
  @options
end

#portObject (readonly)

Returns the value of attribute port.



15
16
17
# File 'lib/pact/mock_service/spawn.rb', line 15

def port
  @port
end

#providerObject (readonly)

Returns the value of attribute provider.



15
16
17
# File 'lib/pact/mock_service/spawn.rb', line 15

def provider
  @provider
end

Class Method Details

.call(consumer, provider, host, port, options) ⇒ Object



11
12
13
# File 'lib/pact/mock_service/spawn.rb', line 11

def self.call consumer, provider, host, port, options
  new(consumer, provider, host, port, options).call
end

Instance Method Details

#callObject



25
26
27
28
29
30
# File 'lib/pact/mock_service/spawn.rb', line 25

def call
  mock_service = build_app
  start_mock_service mock_service, port
  puts "Started mock service for #{provider} on #{port}"
  mock_service
end