Module: Minitest::Tagz::MinitestPatch::RunnableMethodsPatch

Defined in:
lib/minitest/tagz/minitest_patch.rb

Overview

Patch which is used ot filter Minitest’s ‘runnable_methods`

Instance Method Summary collapse

Instance Method Details

#runnable_methodsObject

[View source]

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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