module Minitest::Tagz::MinitestPatch::RunnableMethodsPatch

Patch which is used ot filter Minitest's `runnable_methods`

Public Instance Methods

runnable_methods() click to toggle source
Calls superclass method
# File lib/minitest/tagz/minitest_patch.rb, line 30
def runnable_methods
  all_runnables = super

  if Tagz.positive_tags.any?
    all_runnables.select! do |r|
      serialized = Tagz.serialize(self, r)
      tags_on_runnable = Tagz.tag_map[serialized]
      next false unless tags_on_runnable
      (Tagz.positive_tags - tags_on_runnable).empty?
    end
  end

  if Tagz.negative_tags.any?
    all_runnables.reject! do |r|
      serialized = Tagz.serialize(self, r)
      tags_on_runnable = Tagz.tag_map[serialized]
      next false unless tags_on_runnable
      (Tagz.negative_tags & tags_on_runnable).any?
    end
  end

  all_runnables
end