Sha256: 9b3fd89a8beb537f12fc494b9fb4799765f139c4b290ef78fa309a4ce51aaa6e
Contents?: true
Size: 894 Bytes
Versions: 5
Compression:
Stored size: 894 Bytes
Contents
require 'pact/reification' # Represents the Interaction in the form required by the MockService # The json generated will be posted to the MockService to register the expectation module Pact module Consumer class MockServiceInteractionExpectation def initialize interaction @interaction = interaction end def as_json hash = {:description => interaction.description} hash[:provider_state] = interaction.provider_state if interaction.provider_state options = interaction.request.options.empty? ? {} : { options: interaction.request.options} hash[:request] = interaction.request.as_json.merge(options) hash[:response] = Reification.from_term(interaction.response) hash end def to_json opts = {} as_json.to_json(opts) end private attr_reader :interaction end end end
Version data entries
5 entries across 5 versions & 1 rubygems