Module: Minitest::Tagz

Defined in:
lib/minitest/tagz.rb,
lib/minitest/tagz/version.rb

Defined Under Namespace

Modules: BaseMixin, MinitestPatcher, MinitestRunnerStrategy Classes: Tagger, TaggerFactory

Constant Summary collapse

RunnerStrategy =

Alias

MinitestRunnerStrategy
VERSION =
"1.6.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.



207
208
209
# File 'lib/minitest/tagz.rb', line 207

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.



207
208
209
# File 'lib/minitest/tagz.rb', line 207

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



217
218
219
220
221
# File 'lib/minitest/tagz.rb', line 217

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



223
224
225
# File 'lib/minitest/tagz.rb', line 223

def chosen_tags
  @chosen_tags ||= []
end

.declare_tag_assignment(owner, pending_tags) ⇒ Object



235
236
237
238
239
# File 'lib/minitest/tagz.rb', line 235

def declare_tag_assignment(owner, pending_tags)
  tag_machine = TaggerFactory.create_tagger(owner, pending_tags)
  tag_machine.tags_declared
  tag_machine
end

.negative_tagsObject



231
232
233
# File 'lib/minitest/tagz.rb', line 231

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

.positive_tagsObject



227
228
229
# File 'lib/minitest/tagz.rb', line 227

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