Sha256: c3418cf3e465c99687dfa24fb38449a475a7cb9cdf2dfae969f19d25c3fb3651

Contents?: true

Size: 878 Bytes

Versions: 40

Compression:

Stored size: 878 Bytes

Contents

require 'net/http'
require 'pact/reification'
require 'pact/consumer_contract/interaction'

module Pact
  module Consumer
    class InteractionBuilder

      attr_reader :interaction

      def initialize
        @interaction = Interaction.new
      end

      def upon_receiving description
        @interaction.description = description
        self
      end

      def given provider_state
        @interaction.provider_state = provider_state.nil? ? nil : provider_state.to_s
        self
      end

      def with(request_details)
        interaction.request = Pact::Request::Expected.from_hash(request_details)
        self
      end

      def will_respond_with(response)
        interaction.response = response
        @callback.call interaction
        self
      end

      def on_interaction_fully_defined &block
        @callback = block
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
pact-1.3.3 lib/pact/consumer/interaction_builder.rb
pact-1.3.2 lib/pact/consumer/interaction_builder.rb
pact-1.3.1 lib/pact/consumer/interaction_builder.rb
pact-1.3.0 lib/pact/consumer/interaction_builder.rb
pact-1.2.1.rc2 lib/pact/consumer/interaction_builder.rb
pact-1.2.1.rc1 lib/pact/consumer/interaction_builder.rb
pact-1.1.1 lib/pact/consumer/interaction_builder.rb
pact-1.1.0 lib/pact/consumer/interaction_builder.rb
pact-1.1.0.rc5 lib/pact/consumer/interaction_builder.rb
pact-1.1.0.rc4 lib/pact/consumer/interaction_builder.rb
pact-1.1.0.rc3 lib/pact/consumer/interaction_builder.rb
pact-1.0.39 lib/pact/consumer/interaction_builder.rb
pact-1.1.0.rc2 lib/pact/consumer/interaction_builder.rb
pact-1.0.38 lib/pact/consumer/interaction_builder.rb
pact-1.1.0.rc1 lib/pact/consumer/interaction_builder.rb
pact-1.0.37 lib/pact/consumer/interaction_builder.rb
pact-1.0.36 lib/pact/consumer/interaction_builder.rb
pact-1.0.35 lib/pact/consumer/interaction_builder.rb
pact-1.0.34 lib/pact/consumer/interaction_builder.rb
pact-1.0.33 lib/pact/consumer/interaction_builder.rb