Sha256: 2480beb97a2cf1e543476a4d10dda481ae7d1517eadc4339984b1b0c3a5a9978

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 Bytes

Contents

require 'pact/consumer/mock_service/rack_request_helper'
require 'pact/consumer/mock_service/mock_service_administration_endpoint'

module Pact
  module Consumer

    class InteractionDelete < MockServiceAdministrationEndpoint

      include RackRequestHelper

      attr_accessor :expected_interactions, :actual_interactions

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

      def request_path
        '/interactions'
      end

      def request_method
        'DELETE'
      end

      def respond env
        expected_interactions.clear
        actual_interactions.clear
        logger.info "Cleared interactions before example \"#{example_description(env)}\""
        [200, {}, ['Deleted interactions']]
      end

      def example_description env
        params_hash(env).fetch('example_description', [])[0]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact-mock_service-0.2.4 lib/pact/consumer/mock_service/interaction_delete.rb
pact-mock_service-0.2.3.pre.rc1 lib/pact/consumer/mock_service/interaction_delete.rb