class Minitest::Tagz::Tagger

Represents the individual instance of a `tag` call It is essentially a state machine that works with the patcher to patch and unpatch Minitest properly

Attributes

owner[R]
patchers[R]
pending_tags[R]

Public Class Methods

new(patchers, owner, pending_tags) click to toggle source
# File lib/minitest/tagz/tagger.rb, line 9
def initialize(patchers, owner, pending_tags)
  @patchers = patchers
  @owner = owner
  @pending_tags = pending_tags.map(&:to_s)
end

Public Instance Methods

handle_initial_test_definition!() { || ... } click to toggle source
# File lib/minitest/tagz/tagger.rb, line 20
def handle_initial_test_definition!
  is_initial = @awaiting_initial_test_definition
  @awaiting_initial_test_definition = false if is_initial
  res = yield
  unpatch_test_definitions if is_initial
  res
end
tags_declared!() click to toggle source
# File lib/minitest/tagz/tagger.rb, line 15
def tags_declared!
  patch_test_definitions
  @awaiting_initial_test_definition = true
end

Private Instance Methods

patch_test_definitions() click to toggle source
# File lib/minitest/tagz/tagger.rb, line 30
def patch_test_definitions
  @patchers.each {|p| p.patch(self)}
end
unpatch_test_definitions() click to toggle source
# File lib/minitest/tagz/tagger.rb, line 34
def unpatch_test_definitions
  @patchers.each(&:unpatch)
end