Class: Minitest::Tagz::Tagger

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/tagz.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patchers, owner, pending_tags) ⇒ Tagger

Returns a new instance of Tagger.



122
123
124
125
126
127
# File 'lib/minitest/tagz.rb', line 122

def initialize(patchers, owner, pending_tags)
  @patchers = patchers
  @owner = owner
  @pending_tags = pending_tags.map(&:to_s)
  super()
end

Instance Attribute Details

#ownerObject (readonly)

Returns the value of attribute owner.



120
121
122
# File 'lib/minitest/tagz.rb', line 120

def owner
  @owner
end

#patchersObject (readonly)

Returns the value of attribute patchers.



120
121
122
# File 'lib/minitest/tagz.rb', line 120

def patchers
  @patchers
end

#pending_tagsObject (readonly)

Returns the value of attribute pending_tags.



120
121
122
# File 'lib/minitest/tagz.rb', line 120

def pending_tags
  @pending_tags
end

Instance Method Details

#handle_initial_test_definitionObject



137
138
139
140
141
142
143
# File 'lib/minitest/tagz.rb', line 137

def handle_initial_test_definition
  is_initial = awaiting_test_definition?
  initial_test_definition_encountered if is_initial
  res = yield
  finished_applying_tags if is_initial
  res
end

#patch_test_definitionsObject



129
130
131
# File 'lib/minitest/tagz.rb', line 129

def patch_test_definitions
  @patchers.each {|p| p.patch(self)}
end

#unpatch_test_definitionsObject



133
134
135
# File 'lib/minitest/tagz.rb', line 133

def unpatch_test_definitions
  @patchers.each(&:unpatch)
end