Class: Tracing::Matchers::Span::BeChildOf
- Inherits:
-
Object
- Object
- Tracing::Matchers::Span::BeChildOf
- Defined in:
- lib/tracing/matchers/span/be_child_of.rb
Instance Method Summary collapse
- #description ⇒ String
- #failure_message ⇒ String (also: #failure_message_for_should)
- #failure_message_when_negated ⇒ String (also: #failure_message_for_should_not)
-
#initialize(parent) ⇒ BeChildOf
constructor
A new instance of BeChildOf.
- #matches?(span) ⇒ Boolean
Constructor Details
#initialize(parent) ⇒ BeChildOf
Returns a new instance of BeChildOf.
6 7 8 |
# File 'lib/tracing/matchers/span/be_child_of.rb', line 6 def initialize(parent) @expected = parent end |
Instance Method Details
#description ⇒ String
26 27 28 |
# File 'lib/tracing/matchers/span/be_child_of.rb', line 26 def description any? ? "have a parent" : "have #{} as the parent" end |
#failure_message ⇒ String Also known as: failure_message_for_should
31 32 33 |
# File 'lib/tracing/matchers/span/be_child_of.rb', line 31 def any? ? "expected a parent" : "expected #{} as the parent, got #{}" end |
#failure_message_when_negated ⇒ String Also known as: failure_message_for_should_not
37 38 39 |
# File 'lib/tracing/matchers/span/be_child_of.rb', line 37 def any? ? "did not expect the parent" : "did not expect #{} parent, got #{}" end |
#matches?(span) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tracing/matchers/span/be_child_of.rb', line 11 def matches?(span) @tracer = span.tracer @subject = span # actual is either Span, or SpanContext @actual = parent_of(@subject) case when any? then !!@actual when @actual.nil? && @expected then false else expected_span_id == actual_span_id end end |