class XCKnife::EventsAnalyzer

Attributes

target_class_map[R]
total_tests[R]

Public Class Methods

for(events, relevant_partitions) click to toggle source
# File lib/xcknife/events_analyzer.rb, line 11
def self.for(events, relevant_partitions)
  return NullEventsAnalyzer.new if events.nil?

  new(events, relevant_partitions)
end
new(events, relevant_partitions) click to toggle source
# File lib/xcknife/events_analyzer.rb, line 17
def initialize(events, relevant_partitions)
  @total_tests = 0
  @relevant_partitions = relevant_partitions
  @target_class_map = analyze_events(events)
end

Public Instance Methods

test_class?(target, clazz) click to toggle source
# File lib/xcknife/events_analyzer.rb, line 27
def test_class?(target, clazz)
  test_target?(target) and target_class_map[target].include?(clazz)
end
test_target?(target) click to toggle source
# File lib/xcknife/events_analyzer.rb, line 23
def test_target?(target)
  target_class_map.key?(target)
end

Private Instance Methods

analyze_events(events) click to toggle source
# File lib/xcknife/events_analyzer.rb, line 33
def analyze_events(events)
  ret = Hash.new { |h, key| h[key] = Set.new }
  each_test_event(events) do |target_name, result|
    next unless @relevant_partitions.include?(target_name)

    @total_tests += 1
    ret[target_name] << result.className
  end
  ret
end