Sha256: 1644669f28b2d6bea9616febd3b200449721fe99d611e0444daee7e67d30afce

Contents?: true

Size: 903 Bytes

Versions: 20

Compression:

Stored size: 903 Bytes

Contents

# -*- coding: utf-8 -*-

require 'turnip_formatter/scenario'
require 'turnip_formatter/step/pending'

module TurnipFormatter
  module Scenario
    class NotPendingScenarioError < ::StandardError; end
    class NoExistPendingStepInformationError < ::StandardError; end

    class Pending
      include TurnipFormatter::Scenario

      def steps
        steps = super
        steps[offending_line].extend TurnipFormatter::Step::Pending
        steps
      end

      def validation
        raise NotPendingScenarioError if status != 'pending'
        offending_line
        super
      end

      private

      def offending_line
        unless pending_message =~ /^No such step\((?<stepno>\d+)\): /
          raise NoExistPendingStepInformationError
        end
        $~[:stepno].to_i
      end

      def pending_message
        example.execution_result[:pending_message]
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
turnip_formatter-0.2.11 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.10 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.9 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.8 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.7 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.6 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.5 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.4 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.3 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.2 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.1 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.2.0 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.1.2 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.1.1 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.1.0 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.0.6 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.0.5 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.0.4 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.0.3 lib/turnip_formatter/scenario/pending.rb
turnip_formatter-0.0.2 lib/turnip_formatter/scenario/pending.rb