Sha256: 7ed80ac06a15d505cc9c0c4dc541dd0d7d8f8601cac5955d194765011017425d

Contents?: true

Size: 990 Bytes

Versions: 1

Compression:

Stored size: 990 Bytes

Contents

require 'pact/consumer/mock_service/mock_service_administration_endpoint'
require 'pact/consumer/mock_service/verification'

module Pact
  module Consumer

    class MissingInteractionsGet < MockServiceAdministrationEndpoint
      include RackRequestHelper

      def initialize name, logger, expected_interactions, actual_interactions
        super name, logger
        @expected_interactions = expected_interactions
        @actual_interactions = actual_interactions
      end

      def request_path
        '/interactions/missing'
      end

      def request_method
        'GET'
      end

      def respond env
        verification = Verification.new(@expected_interactions, @actual_interactions)
        number_of_missing_interactions = verification.missing_interactions.size
        logger.info "Number of missing interactions for mock \"#{name}\" = #{number_of_missing_interactions}"
        [200, {}, [{size: number_of_missing_interactions}.to_json]]
      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/missing_interactions_get.rb