Class: Cucumber::Filters::TagLimits::TestCaseIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/filters/tag_limits/test_case_index.rb

Instance Method Summary collapse

Constructor Details

#initializeTestCaseIndex

Returns a new instance of TestCaseIndex



7
8
9
# File 'lib/cucumber/filters/tag_limits/test_case_index.rb', line 7

def initialize
  @index = Hash.new { |hash, key| hash[key] = [] }
end

Instance Method Details

#add(test_case) ⇒ Object



11
12
13
14
15
# File 'lib/cucumber/filters/tag_limits/test_case_index.rb', line 11

def add(test_case)
  test_case.tags.map(&:name).each do |tag_name|
    index[tag_name] << test_case
  end
end

#count_by_tag_name(tag_name) ⇒ Object



17
18
19
# File 'lib/cucumber/filters/tag_limits/test_case_index.rb', line 17

def count_by_tag_name(tag_name)
  index[tag_name].count
end

#locations_of_tag_name(tag_name) ⇒ Object



21
22
23
# File 'lib/cucumber/filters/tag_limits/test_case_index.rb', line 21

def locations_of_tag_name(tag_name)
  index[tag_name].map(&:location)
end