Class: Pact::MockService::Interactions::Verification
- Inherits:
-
Object
- Object
- Pact::MockService::Interactions::Verification
- Defined in:
- lib/pact/mock_service/interactions/verification.rb
Instance Method Summary collapse
- #all_matched? ⇒ Boolean
-
#initialize(expected_interactions, actual_interactions) ⇒ Verification
constructor
A new instance of Verification.
- #interaction_diffs ⇒ Object
- #interaction_mismatches ⇒ Object
- #interaction_mismatches_summaries ⇒ Object
- #missing_interactions ⇒ Object
- #missing_interactions_summaries ⇒ Object
- #unexpected_requests_summaries ⇒ Object
Constructor Details
#initialize(expected_interactions, actual_interactions) ⇒ Verification
Returns a new instance of Verification.
6 7 8 9 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 6 def initialize expected_interactions, actual_interactions @expected_interactions = expected_interactions @actual_interactions = actual_interactions end |
Instance Method Details
#all_matched? ⇒ Boolean
11 12 13 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 11 def all_matched? interaction_diffs.empty? end |
#interaction_diffs ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 15 def interaction_diffs { :missing_interactions => missing_interactions_summaries, :interaction_mismatches => interaction_mismatches_summaries, :unexpected_requests => unexpected_requests_summaries }.each_with_object({}) do | (key, value), hash | hash[key] = value if value.any? end end |
#interaction_mismatches ⇒ Object
41 42 43 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 41 def interaction_mismatches actual_interactions.interaction_mismatches end |
#interaction_mismatches_summaries ⇒ Object
29 30 31 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 29 def interaction_mismatches_summaries actual_interactions.interaction_mismatches.collect(&:short_summary) end |
#missing_interactions ⇒ Object
37 38 39 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 37 def missing_interactions expected_interactions - actual_interactions.matched_interactions - @actual_interactions.interaction_mismatches.collect(&:candidate_interactions).flatten end |
#missing_interactions_summaries ⇒ Object
25 26 27 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 25 def missing_interactions_summaries missing_interactions.collect(&:request).collect(&:method_and_path) end |
#unexpected_requests_summaries ⇒ Object
33 34 35 |
# File 'lib/pact/mock_service/interactions/verification.rb', line 33 def unexpected_requests_summaries actual_interactions.unexpected_requests.collect(&:method_and_path) end |