Module: Minitest::Tagz

Defined in:
lib/minitest/tagz.rb,
lib/minitest/tagz/tagger.rb,
lib/minitest/tagz/patcher.rb,
lib/minitest/tagz/version.rb,
lib/minitest/tagz/minitest_patch.rb,
lib/minitest/tagz/minitest_test_patch.rb

Defined Under Namespace

Modules: MinitestPatch, MinitestTestPatch, Patcher Classes: Tagger

Constant Summary collapse

VERSION =
"1.7.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.log_if_no_matchObject Also known as: log_if_no_match?

Returns the value of attribute log_if_no_match.



11
12
13
# File 'lib/minitest/tagz.rb', line 11

def log_if_no_match
  @log_if_no_match
end

.run_all_if_no_matchObject Also known as: run_all_if_no_match?

Returns the value of attribute run_all_if_no_match.



11
12
13
# File 'lib/minitest/tagz.rb', line 11

def run_all_if_no_match
  @run_all_if_no_match
end

Class Method Details

.choose_tags(*tags, log_if_no_match: false, run_all_if_no_match: false) ⇒ Object

Create a master TagSet that you wish to test. You only want to run tests with tags in this set

Parameters:

  • tags (Enumerable<Symbol>)
    • a list of tags you want to test

  • run_all_if_no_match (Boolean) (defaults to: false)
    • will run all tests if no tests are found with the tag

  • log_if_no_match (Boolean) (defaults to: false)
    • puts if no match specs found



22
23
24
25
26
# File 'lib/minitest/tagz.rb', line 22

def choose_tags(*tags, log_if_no_match: false, run_all_if_no_match: false)
  @chosen_tags = tags.map(&:to_s)
  @run_all_if_no_match = run_all_if_no_match
  @log_if_no_match = log_if_no_match
end

.chosen_tagsObject



29
30
31
# File 'lib/minitest/tagz.rb', line 29

def chosen_tags
  @chosen_tags ||= []
end

.negative_tagsObject



39
40
41
# File 'lib/minitest/tagz.rb', line 39

def negative_tags
  chosen_tags.select {|t| t.is_a?(String) && t[/^-/]}.map {|t| t[1..-1]}
end

.positive_tagsObject



34
35
36
# File 'lib/minitest/tagz.rb', line 34

def positive_tags
  chosen_tags.reject {|t| t.is_a?(String) && t[/^-/]}
end

.serialize(owner, test_name) ⇒ Object



44
45
46
# File 'lib/minitest/tagz.rb', line 44

def serialize(owner, test_name)
  "#{owner} >> #{test_name}"
end

.tag_mapObject



49
50
51
# File 'lib/minitest/tagz.rb', line 49

def tag_map
  @tag_map ||= {}
end