Class: Pact::MockService::ControlServer::App

Inherits:
Object
  • Object
show all
Includes:
Consumer::RackRequestHelper
Defined in:
lib/pact/mock_service/control_server/app.rb

Constant Summary

Constants included from Consumer::RackRequestHelper

Consumer::RackRequestHelper::REQUEST_KEYS

Instance Method Summary collapse

Methods included from Consumer::RackRequestHelper

#params_hash, #request_as_hash_from

Constructor Details

#initialize(options = {}) ⇒ App

Returns a new instance of App.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pact/mock_service/control_server/app.rb', line 16

def initialize options = {}
  @mock_services = mock_services = MockServices.new([])
  @app = Rack::Builder.new {
    run Rack::Cascade.new([
      Index.new,
      Rack::Builder.new {
        use RequirePacticipantHeaders
        run Rack::Cascade.new([
          mock_services,
          MockServiceCreator.new(mock_services, options)
        ])
      }
    ])
  }
end

Instance Method Details

#call(env) ⇒ Object



32
33
34
# File 'lib/pact/mock_service/control_server/app.rb', line 32

def call env
  @app.call(env)
end

#shutdownObject



36
37
38
# File 'lib/pact/mock_service/control_server/app.rb', line 36

def shutdown
  @mock_services.shutdown
end