Sha256: 1d509a85779867dabca7e4011dfced9f0f846c1644b9338c6089729b5fb7d124

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

require 'pact/consumer/mock_service/mock_service_administration_endpoint'

module Pact
  module Consumer
    class InteractionPost < MockServiceAdministrationEndpoint

      attr_accessor :interaction_list

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

      def request_path
        '/interactions'
      end

      def request_method
        'POST'
      end

      def respond env
        interaction = Interaction.from_hash(JSON.load(env['rack.input'].string))
        interaction_list.add interaction
        logger.info "Registered expected interaction #{interaction.request.method_and_path}"
        logger.debug JSON.pretty_generate interaction
        [200, {}, ['Added interaction']]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact-1.1.0.rc3 lib/pact/consumer/mock_service/interaction_post.rb