Class: Pact::Consumer::InteractionBuilder
- Inherits:
-
Object
- Object
- Pact::Consumer::InteractionBuilder
- Defined in:
- lib/pact/consumer/interaction_builder.rb
Instance Attribute Summary collapse
-
#interaction ⇒ Object
readonly
Returns the value of attribute interaction.
Instance Method Summary collapse
- #given(provider_state) ⇒ Object
-
#initialize ⇒ InteractionBuilder
constructor
A new instance of InteractionBuilder.
- #on_interaction_fully_defined(&block) ⇒ Object
- #upon_receiving(description) ⇒ Object
- #will_respond_with(response) ⇒ Object
- #with(request_details) ⇒ Object
Constructor Details
#initialize ⇒ InteractionBuilder
Returns a new instance of InteractionBuilder.
11 12 13 |
# File 'lib/pact/consumer/interaction_builder.rb', line 11 def initialize @interaction = Interaction.new end |
Instance Attribute Details
#interaction ⇒ Object (readonly)
Returns the value of attribute interaction.
9 10 11 |
# File 'lib/pact/consumer/interaction_builder.rb', line 9 def interaction @interaction end |
Instance Method Details
#given(provider_state) ⇒ Object
20 21 22 23 |
# File 'lib/pact/consumer/interaction_builder.rb', line 20 def given provider_state @interaction.provider_state = provider_state.nil? ? nil : provider_state.to_s self end |
#on_interaction_fully_defined(&block) ⇒ Object
36 37 38 |
# File 'lib/pact/consumer/interaction_builder.rb', line 36 def on_interaction_fully_defined &block @callback = block end |
#upon_receiving(description) ⇒ Object
15 16 17 18 |
# File 'lib/pact/consumer/interaction_builder.rb', line 15 def upon_receiving description @interaction.description = description self end |
#will_respond_with(response) ⇒ Object
30 31 32 33 34 |
# File 'lib/pact/consumer/interaction_builder.rb', line 30 def will_respond_with(response) interaction.response = response @callback.call interaction self end |