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.0.32 lib/pact/consumer/interaction_builder.rb
pact-1.0.31 lib/pact/consumer/interaction_builder.rb
pact-1.0.30 lib/pact/consumer/interaction_builder.rb
pact-1.0.29 lib/pact/consumer/interaction_builder.rb
pact-1.0.28 lib/pact/consumer/interaction_builder.rb
pact-1.0.27 lib/pact/consumer/interaction_builder.rb
pact-1.0.26 lib/pact/consumer/interaction_builder.rb
pact-1.0.25 lib/pact/consumer/interaction_builder.rb
pact-1.0.24 lib/pact/consumer/interaction_builder.rb
pact-1.0.23 lib/pact/consumer/interaction_builder.rb
pact-1.0.22 lib/pact/consumer/interaction_builder.rb
pact-1.0.21 lib/pact/consumer/interaction_builder.rb
pact-1.0.20 lib/pact/consumer/interaction_builder.rb
pact-1.0.19 lib/pact/consumer/interaction_builder.rb
pact-1.0.18 lib/pact/consumer/interaction_builder.rb
pact-1.0.15 lib/pact/consumer/interaction_builder.rb
pact-1.0.13 lib/pact/consumer/interaction_builder.rb
pact-1.0.12 lib/pact/consumer/interaction_builder.rb
pact-1.0.11 lib/pact/consumer/interaction_builder.rb
pact-1.0.10 lib/pact/consumer/interaction_builder.rb