Class: IntervalSkipListSpecHelper::HaveMarkers

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected_markers) ⇒ HaveMarkers

Returns a new instance of HaveMarkers.



65
66
67
# File 'lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb', line 65

def initialize(expected_markers)
  @expected_markers = expected_markers
end

Instance Method Details

#failure_messageObject



78
79
80
# File 'lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb', line 78

def failure_message
  "Expected #{@target.inspect} to include only #{@expected_markers.inspect}"
end

#matches?(target) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
72
73
74
75
76
# File 'lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb', line 69

def matches?(target)
  @target = target
  return false unless @target.size == @expected_markers.size
  @expected_markers.each do |expected_marker|
    return false unless @target.include?(expected_marker)
  end
  true
end