Sha256: 0b5d737888101af70699b694994dd6324a7f4ecd2bf389065890917ecf01d4a9

Contents?: true

Size: 1.08 KB

Versions: 81

Compression:

Stored size: 1.08 KB

Contents

require 'pact/consumer/mock_service/rack_request_helper'
require 'pact/mock_service/control_server/require_pacticipant_headers'
require 'pact/mock_service/control_server/index'
require 'pact/mock_service/control_server/mock_services'
require 'pact/mock_service/control_server/mock_service_creator'
require 'rack'
require 'rack/cascade'

module Pact
  module MockService
    module ControlServer
      class App

        include Pact::Consumer::RackRequestHelper

        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

        def call env
          @app.call(env)
        end

        def shutdown
          @mock_services.shutdown
        end
      end
    end
  end
end

Version data entries

81 entries across 81 versions & 2 rubygems

Version Path
pact-mock_service-3.12.3 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.12.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.12.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.12.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.11.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.11.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.11.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.10.0 lib/pact/mock_service/control_server/app.rb
hs-pact-mock_service-3.9.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.9.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.9.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.8.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.7.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.6.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.6.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.6.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.5.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.4.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.3.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-3.3.0 lib/pact/mock_service/control_server/app.rb