class Pact::Consumer::InteractionBuilder

Attributes

interaction[R]

Public Class Methods

new(&block) click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 11
def initialize &block
  @interaction = Interaction.new
  @callback = block
end

Public Instance Methods

given(provider_state) click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 27
def given provider_state
  @interaction.provider_state = provider_state.nil? ? nil : provider_state.to_s
  self
end
upon_receiving(description) click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 22
def upon_receiving description
  @interaction.description = description
  self
end
will_respond_with(response) click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 37
def will_respond_with(response)
  interaction.response = Pact::Response.new(response)
  @callback.call interaction
  self
end
with(request_details) click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 32
def with(request_details)
  interaction.request = Pact::Request::Expected.from_hash(request_details)
  self
end
without_writing_to_pact() click to toggle source
# File lib/pact/consumer/interaction_builder.rb, line 16
def without_writing_to_pact
  interaction.metadata ||= {}
  interaction.metadata[:write_to_pact] = false
  self
end