Sha256: 6d8f3aeca6ace895e4f03c13bcc8d440731e4fb0b6441bcb4d7727ae435e2494

Contents?: true

Size: 1.02 KB

Versions: 51

Compression:

Stored size: 1.02 KB

Contents

module Cucumber
  module Formatter
    module Summary

      def scenario_summary(runtime, &block)
        scenarios_proc = lambda{|status| runtime.scenarios(status)}
        dump_count(runtime.scenarios.length, "scenario") + dump_status_counts(scenarios_proc, &block)
      end

      def step_summary(runtime, &block)
        steps_proc = lambda{|status| runtime.steps(status)}
        dump_count(runtime.steps.length, "step") + dump_status_counts(steps_proc, &block)
      end

      private

      def dump_status_counts(find_elements_proc)
        counts = [:failed, :skipped, :undefined, :pending, :passed].map do |status|
          elements = find_elements_proc.call(status)
          elements.any? ? yield("#{elements.length} #{status.to_s}", status) : nil
        end.compact
        if counts.any?
          " (#{counts.join(', ')})"
        else
          ""
        end
      end

      def dump_count(count, what, state=nil)
        [count, state, "#{what}#{count == 1 ? '' : 's'}"].compact.join(" ")
      end

    end
  end
end

Version data entries

51 entries across 49 versions & 3 rubygems

Version Path
cucumber-2.99.0 lib/cucumber/formatter/summary.rb
mobiusloop-0.1.5 lib/cucumber/formatter/summary.rb
cucumber-2.4.0 lib/cucumber/formatter/summary.rb
mobiusloop-0.1.3 lib/cucumber/formatter/summary.rb
mobiusloop-0.1.2 lib/cucumber/formatter/summary.rb
cucumber-2.3.3 lib/cucumber/formatter/summary.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/cucumber-1.3.18/lib/cucumber/formatter/summary.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/cucumber-1.3.18/lib/cucumber/formatter/summary.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/cucumber-1.3.16/lib/cucumber/formatter/summary.rb
cucumber-2.3.2 lib/cucumber/formatter/summary.rb
cucumber-2.3.1 lib/cucumber/formatter/summary.rb
cucumber-2.3.0 lib/cucumber/formatter/summary.rb
cucumber-2.2.0 lib/cucumber/formatter/summary.rb
cucumber-2.1.0 lib/cucumber/formatter/summary.rb
cucumber-2.0.2 lib/cucumber/formatter/summary.rb
cucumber-2.0.1 lib/cucumber/formatter/summary.rb
cucumber-1.3.20 lib/cucumber/formatter/summary.rb
cucumber-2.0.0 lib/cucumber/formatter/summary.rb
cucumber-2.0.0.rc.5 lib/cucumber/formatter/summary.rb
cucumber-1.3.19 lib/cucumber/formatter/summary.rb