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-0.10.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.10.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.9.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.8.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.8.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.8.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.7.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.7.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.7.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.6.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.5 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.4 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.3 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.5.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.4.2 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.4.1 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.4.0 lib/pact/mock_service/control_server/app.rb
pact-mock_service-0.3.0 lib/pact/mock_service/control_server/app.rb