lib/cucumber/cli/main.rb in cucumber-0.3.93 vs lib/cucumber/cli/main.rb in cucumber-0.3.94

- old
+ new

@@ -9,10 +9,12 @@ require 'cucumber/cli/drb_client' module Cucumber module Cli class Main + FAILURE = 1 + class << self def step_mother @step_mother end @@ -30,11 +32,11 @@ def initialize(args, out_stream = STDOUT, error_stream = STDERR) @args = args @out_stream = out_stream == STDOUT ? Formatter::ColorIO.new : out_stream @error_stream = error_stream end - + def execute!(step_mother) trap_interrupt if configuration.drb? begin return DRbClient.run(@args, @error_stream, @out_stream) @@ -54,21 +56,36 @@ visitor = configuration.build_formatter_broadcaster(step_mother) step_mother.visitor = visitor # Needed to support World#announce visitor.visit_features(features) - failure = if configuration.wip? - step_mother.scenarios(:passed).any? - else - step_mother.scenarios(:failed).any? || - (configuration.strict? && step_mother.steps(:undefined).any?) - end + failure = if exceeded_tag_limts?(features) + FAILURE + elsif configuration.wip? + step_mother.scenarios(:passed).any? + else + step_mother.scenarios(:failed).any? || + (configuration.strict? && step_mother.steps(:undefined).any?) + end rescue ProfilesNotDefinedError, YmlLoadError, ProfileNotFound => e @error_stream.puts e.message true end + def exceeded_tag_limts?(features) + exceeded = false + configuration.options[:include_tags].each do |tag, limit| + unless limit.nil? + tag_count = features.tag_count(tag) + if tag_count > limit.to_i + exceeded = true + end + end + end + exceeded + end + def load_plain_text_features features = Ast::Features.new verbose_log("Features:") configuration.feature_files.each do |f| @@ -83,10 +100,10 @@ features end def configuration return @configuration if @configuration - + @configuration = Configuration.new(@out_stream, @error_stream) @configuration.parse!(@args) @configuration end