class M::TestCollection
test methods
In charge of some smart querying, filtering, sorting, etc on the the
## Custom wrapper around an array of test methods
def by_line_number &block
def by_line_number &block # On each member of the collection, sort by line number and yield # the block into the sorted collection sort_by(&:start_line).each(&block) end
def column_size
def column_size # Boil down the collection of test methods to the name of the method's # size, then find the largest one @column_size ||= map { |test| test.name.to_s.size }.max end
def initialize collection = nil
def initialize collection = nil @collection = collection || [] end
def within lines
Slice out tests that may be within the given line.
def within lines # Into a new collection, filter only the tests that... collection = select do |test| lines.none? || lines.any? { |line| (test.start_line..test.end_line).cover?(line) } end self.class.new collection end