lib/pact/messages/consumer/interaction_builder.rb in pact-messages-0.1.1 vs lib/pact/messages/consumer/interaction_builder.rb in pact-messages-0.2.0

- old
+ new

@@ -1,16 +1,16 @@ -require 'net/http' +require "net/http" module Pact module Messages module Consumer class InteractionBuilder attr_reader :interaction def initialize(&block) @interaction = Pact::Messages::Consumer::Interaction.new - @interaction.request = Pact::Request::Expected.from_hash(method: 'MESSAGE', path: '/') + @interaction.request = Pact::Request::Expected.from_hash(method: "MESSAGE", path: "/") @callback = block end def given(provider_state) interaction.provider_state = provider_state.nil? ? nil : provider_state.to_s @@ -18,9 +18,14 @@ end def provide(response) interaction.response = Pact::Response.new(body: response) @callback.call interaction + end + + def description(description) + interaction.description = description.nil? ? "" : description.to_s + self end end end end end