Sha256: 6c613e0860fd274e6cd8f9fabf2728a1c3bcc974c0b308d800dd60ad06e7b0f0

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

require 'pact/consumer/mock_service/mock_service_administration_endpoint'

module Pact
  module Consumer
    class VerificationGet < MockServiceAdministrationEndpoint

      include RackRequestHelper
      attr_accessor :interaction_list, :log_description

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

      def request_path
        '/verify'
      end

      def request_method
        'GET'
      end

      def respond env
        if interaction_list.all_matched?
          logger.info "Verifying - interactions matched for example \"#{example_description(env)}\""
          [200, {}, ['Interactions matched']]
        else
          logger.warn "Verifying - actual interactions do not match expected interactions for example \"#{example_description(env)}\". Interaction diffs:"
          logger.ap interaction_list.interaction_diffs, :warn
          [500, {}, ["Actual interactions do not match expected interactions for mock #{name}. See #{log_description} for details."]]
        end
      end

      def example_description env
        params_hash(env)['example_description']
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact-1.0.22 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.21 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.20 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.19 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.18 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.15 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.13 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.12 lib/pact/consumer/mock_service/verification_get.rb
pact-1.0.11 lib/pact/consumer/mock_service/verification_get.rb