class Tracing::Matchers::Span::FollowAfter

@private

Public Class Methods

new(previous) click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 8
def initialize(previous)
  NotNull! previous
  @expected = previous
end

Public Instance Methods

description() click to toggle source

@return [String]

# File lib/tracing/matchers/span/follow_after.rb, line 23
def description
  "follow after #{expected_message}"
end
failure_message() click to toggle source

@return [String]

# File lib/tracing/matchers/span/follow_after.rb, line 28
def failure_message
  "expected #{subject_message} to follow after #{expected_message}"
end
Also aliased as: failure_message_for_should
failure_message_for_should()
Alias for: failure_message
failure_message_for_should_not()
failure_message_when_negated() click to toggle source

@return [String]

# File lib/tracing/matchers/span/follow_after.rb, line 34
def failure_message_when_negated
  "did not expected #{subject_message} to follow after #{expected_message}"
end
matches?(span) click to toggle source

@return [Boolean]

# File lib/tracing/matchers/span/follow_after.rb, line 14
def matches?(span)
  @tracer = span.tracer
  @subject = span

  return false unless expected_index && subject_index
  expected_index < subject_index
end

Private Instance Methods

expected_index() click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 41
def expected_index
  @tracer.spans.find_index(expected_span)
end
expected_message() click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 58
def expected_message
  case
  when @expected.respond_to?(:context) then "the span with operation name \"#{@expected.operation_name}\""
  when @expected.is_a?(String) then "a span with operation name \"#{@expected}\""
  else nil
  end
end
expected_span() click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 49
def expected_span
  case
  when @expected.respond_to?(:context) then @expected
  when @expected.is_a?(String)
    @tracer.spans.find { |span| span.operation_name == @expected }
  else @expected
  end
end
subject_index() click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 45
def subject_index
  @tracer.spans.find_index(@subject)
end
subject_message() click to toggle source
# File lib/tracing/matchers/span/follow_after.rb, line 66
def subject_message
  "a span with operation name \"#{@subject.operation_name}\""
end