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-2.6.3 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.6.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.6.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.5.4 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.5.3 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.5.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.4.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.3.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.2.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.1.1.pre.alpha.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.1.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.0.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-2.0.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-1.2.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-1.1.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-1.0.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.12.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.12.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.11.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.10.2 lib/pact/mock_service/control_server/app.rb