Sha256: 5f5bee179aa75829b6faa40ed7750a68602f15fc70f728ab7d54739c877fc03b

Contents?: true

Size: 699 Bytes

Versions: 2

Compression:

Stored size: 699 Bytes

Contents

require 'turnip_formatter/scenario/base'

module TurnipFormatter
  module Scenario
    class Failure < Base
      def steps
        steps = super
        steps[@offending_line].status = :failed
        steps[(@offending_line + 1)..-1].each do |step|
          step.status = :unexecuted
        end
        steps
      end

      protected

        def validation
          if failed_message =~ /:in step:(?<stepno>\d+) `/
            @offending_line = $~[:stepno].to_i
          else
            @errors << 'has no failed step information'
          end

          super
        end

      private

        def failed_message
          example.exception.backtrace.last
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
turnip_formatter-0.3.1 lib/turnip_formatter/scenario/failure.rb
turnip_formatter-0.3.0 lib/turnip_formatter/scenario/failure.rb