class Cucumber::Filters::TagLimits::Verifier

Attributes

tag_limits[R]

Public Class Methods

new(tag_limits) click to toggle source
# File lib/cucumber/filters/tag_limits/verifier.rb, line 6
def initialize(tag_limits)
  @tag_limits = tag_limits
end

Public Instance Methods

verify!(test_case_index) click to toggle source
# File lib/cucumber/filters/tag_limits/verifier.rb, line 10
def verify!(test_case_index)
  breaches = collect_breaches(test_case_index)
  raise TagLimitExceededError.new(*breaches) unless breaches.empty?
end

Private Instance Methods

collect_breaches(test_case_index) click to toggle source
# File lib/cucumber/filters/tag_limits/verifier.rb, line 17
def collect_breaches(test_case_index)
  tag_limits.reduce([]) do |breaches, (tag_name, limit)|
    breaches.tap do |breach|
      breach << Breach.new(tag_name, limit, test_case_index.locations_of_tag_name(tag_name)) if test_case_index.count_by_tag_name(tag_name) > limit
    end
  end
end