Sha256: de7ef0e407ac8c49fa01fe98af461bdd6fed0c1f8c4be99cb804a6ca34e35dae

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

require 'pact/consumer/mock_service/rack_request_helper'
module Pact
  module Consumer
    class MockServiceAdministrationEndpoint

      include RackRequestHelper

      attr_accessor :logger, :name

      def initialize name, logger
        @name = name
        @logger = logger
      end

      def match? env
        has_mock_service_header?(env) && path_matches?(env) && method_matches?(env)
      end

      def has_mock_service_header? env
        env['HTTP_X_PACT_MOCK_SERVICE']
      end

      def path_matches? env
        env['PATH_INFO'].chomp("/") == request_path
      end

      def method_matches? env
        env['REQUEST_METHOD'] == request_method
      end

      def request_path
        raise NotImplementedError
      end

      def request_method
        raise NotImplementedError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact-mock_service-0.2.4 lib/pact/consumer/mock_service/mock_service_administration_endpoint.rb