Sha256: d9b2987e9b1af0110cb1ee6a710490c2e0c2d977f257d1171ff1511432ada23e

Contents?: true

Size: 1.04 KB

Versions: 103

Compression:

Stored size: 1.04 KB

Contents

module Cucumber
  module Formatter
    module Summary

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

      def step_summary(step_mother, &block)
        steps_proc = lambda{|status| step_mother.steps(status)}
        dump_count(step_mother.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

103 entries across 101 versions & 16 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
pretty_face-0.7 sample_report/some_code/summary.rb
pretty_face-0.6.1 sample_report/some_code/summary.rb
pretty_face-0.6 sample_report/some_code/summary.rb
pretty_face-0.5 sample_report/some_code/summary.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
pretty_face-0.4 sample_report/some_code/summary.rb
pretty_face-0.3 sample_report/some_code/summary.rb
pretty_face-0.2 sample_report/some_code/summary.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
pretty_face-0.1 sample_report/some_code/summary.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
casecumber-1.0.2.1 lib/cucumber/formatter/summary.rb
casecumber-1.2.1.cb2 lib/cucumber/formatter/summary.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/lib/cucumber/formatter/summary.rb
cucumber-1.2.1 lib/cucumber/formatter/summary.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/lib/cucumber/formatter/summary.rb
ftl-0.2.0 vendor/bundle/gems/cucumber-1.2.0/lib/cucumber/formatter/summary.rb