Class: Minitest::Tagz::Tagger

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/tagz/tagger.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.



9
10
11
12
13
# 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

Instance Attribute Details

#ownerObject (readonly)

Returns the value of attribute owner.



7
8
9
# File 'lib/minitest/tagz/tagger.rb', line 7

def owner
  @owner
end

#patchersObject (readonly)

Returns the value of attribute patchers.



7
8
9
# File 'lib/minitest/tagz/tagger.rb', line 7

def patchers
  @patchers
end

#pending_tagsObject (readonly)

Returns the value of attribute pending_tags.



7
8
9
# File 'lib/minitest/tagz/tagger.rb', line 7

def pending_tags
  @pending_tags
end

Instance Method Details

#handle_initial_test_definition!Object



20
21
22
23
24
25
26
# 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!Object



15
16
17
18
# File 'lib/minitest/tagz/tagger.rb', line 15

def tags_declared!
  patch_test_definitions
  @awaiting_initial_test_definition = true
end