Sha256: fd8784e934cd1d1d5993cd40040a781448be0e387f9f3c765d1d893585a51c1f

Contents?: true

Size: 1.43 KB

Versions: 9

Compression:

Stored size: 1.43 KB

Contents

module Cucumber
  module Formatter
    # The formatter used for <tt>--format rerun</tt>
    #
    # This formatter keeps track of all failing features and print out their location.
    # Example:
    #
    #   features/foo.feature:34 features/bar.feature:11:76:81
    #
    # This formatter is used by AutoTest - it will use the output to decide what
    # to run the next time, simply passing the output string on the command line.
    #
    class Rerun
      def initialize(step_mother, io, options)
        @io = io
        @options = options
        @file_names = []
        @file_colon_lines = Hash.new{|h,k| h[k] = []}
      end

      # features() is never executed at all... ?
      def after_features(features)
        files = @file_names.uniq.map do |file|
          lines = @file_colon_lines[file]
          "#{file}:#{lines.join(':')}"
        end
        @io.puts files.join(' ')
        
        # Flusing output to rerun tempfile here...
        @io.flush
        @io.close
      end

      # feature_element() is never executed at all, either... ?
      def after_feature_element(feature_element)
        if feature_element.failed?
          file, line = *feature_element.file_colon_line.split(':')
          @file_colon_lines[file] << line
          @file_names << file
        end
      end

      def step_name(keyword, step_match, status, source_indent, background)
        @rerun = true if [:failed].index(status)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
middleman-0.10.17 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/formatter/rerun.rb
middleman-0.10.16 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/formatter/rerun.rb
middleman-0.10.15 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/formatter/rerun.rb
rackjour-0.1.8 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/formatter/rerun.rb
middleman-0.10.14 vendor/gems/gems/cucumber-0.4.4/lib/cucumber/formatter/rerun.rb
cucumber-0.4.4 lib/cucumber/formatter/rerun.rb
cucumber-0.4.3 lib/cucumber/formatter/rerun.rb
cucumber-0.4.2 lib/cucumber/formatter/rerun.rb
cucumber-0.4.1 lib/cucumber/formatter/rerun.rb