Class: Pact::MockService::ControlServer::MockServiceCreator
- Inherits:
-
Object
- Object
- Pact::MockService::ControlServer::MockServiceCreator
- Defined in:
- lib/pact/mock_service/control_server/mock_service_creator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(mock_services, options) ⇒ MockServiceCreator
constructor
A new instance of MockServiceCreator.
Constructor Details
#initialize(mock_services, options) ⇒ MockServiceCreator
Returns a new instance of MockServiceCreator.
15 16 17 18 |
# File 'lib/pact/mock_service/control_server/mock_service_creator.rb', line 15 def initialize mock_services, @mock_services = mock_services @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/pact/mock_service/control_server/mock_service_creator.rb', line 13 def @options end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/pact/mock_service/control_server/mock_service_creator.rb', line 20 def call env consumer_name = env['HTTP_X_PACT_CONSUMER'] provider_name = env['HTTP_X_PACT_PROVIDER'] port = FindAPort.available_port mock_service = Pact::MockService::Spawn.(consumer_name, provider_name, [:host] || 'localhost', port, ) delegator = Delegator.new(mock_service, consumer_name, provider_name) @mock_services.add(delegator) delegator.call(env) end |