Class: Pact::MockService::Interactions::InteractionMismatch
- Inherits:
-
Object
- Object
- Pact::MockService::Interactions::InteractionMismatch
- Defined in:
- lib/pact/mock_service/interactions/interaction_mismatch.rb
Overview
expected interactions where the methods and paths match the actual request. This is used to display a helpful message to the user when a request comes in that doesn’t match any of the expected interactions.
Defined Under Namespace
Classes: CandidateDiff
Instance Attribute Summary collapse
-
#actual_request ⇒ Object
Returns the value of attribute actual_request.
-
#candidate_interactions ⇒ Object
Returns the value of attribute candidate_interactions.
Instance Method Summary collapse
-
#initialize(candidate_interactions, actual_request) ⇒ InteractionMismatch
constructor
Assumes the method and path matches…
- #short_summary ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(candidate_interactions, actual_request) ⇒ InteractionMismatch
Assumes the method and path matches…
14 15 16 17 18 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 14 def initialize candidate_interactions, actual_request @candidate_interactions = candidate_interactions @actual_request = actual_request @candiate_diffs = candidate_interactions.collect{ | candidate_interaction| CandidateDiff.new(candidate_interaction, actual_request)} end |
Instance Attribute Details
#actual_request ⇒ Object
Returns the value of attribute actual_request.
10 11 12 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 10 def actual_request @actual_request end |
#candidate_interactions ⇒ Object
Returns the value of attribute candidate_interactions.
10 11 12 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 10 def candidate_interactions @candidate_interactions end |
Instance Method Details
#short_summary ⇒ Object
28 29 30 31 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 28 def short_summary mismatched_attributes = candiate_diffs.collect(&:mismatched_attributes).flatten.uniq.join(", ").reverse.sub(",", "dna ").reverse #OMG what a hack! actual_request.method_and_path + " (request #{mismatched_attributes} did not match)" end |
#to_hash ⇒ Object
20 21 22 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 20 def to_hash candiate_diffs.collect(&:to_hash) end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/pact/mock_service/interactions/interaction_mismatch.rb', line 24 def to_s candiate_diffs.collect(&:to_s).join("\n") end |