Class: Pact::Consumer::MockServiceInteractionExpectation
- Inherits:
-
Object
- Object
- Pact::Consumer::MockServiceInteractionExpectation
- Defined in:
- lib/pact/consumer/mock_service_interaction_expectation.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(interaction) ⇒ MockServiceInteractionExpectation
constructor
A new instance of MockServiceInteractionExpectation.
- #to_hash ⇒ Object
- #to_json(opts = {}) ⇒ Object
Constructor Details
#initialize(interaction) ⇒ MockServiceInteractionExpectation
Returns a new instance of MockServiceInteractionExpectation.
10 11 12 |
# File 'lib/pact/consumer/mock_service_interaction_expectation.rb', line 10 def initialize interaction @interaction = interaction end |
Instance Method Details
#as_json(options = {}) ⇒ Object
23 24 25 |
# File 'lib/pact/consumer/mock_service_interaction_expectation.rb', line 23 def as_json = {} to_hash end |
#to_hash ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/pact/consumer/mock_service_interaction_expectation.rb', line 14 def to_hash hash = {:description => interaction.description} hash[:provider_state] = interaction.provider_state if interaction.provider_state = interaction.request..empty? ? {} : { options: interaction.request.} hash[:request] = interaction.request.as_json.merge() hash[:response] = Reification.from_term(interaction.response) hash end |
#to_json(opts = {}) ⇒ Object
27 28 29 |
# File 'lib/pact/consumer/mock_service_interaction_expectation.rb', line 27 def to_json opts = {} as_json.to_json(opts) end |