Sha256: 51f3621afe48f5eebbdc8bf0a6ad5b130aa30f3a4bccd1073c1e2185d40cd4c8

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 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].tap do |step|
          step.extend TurnipFormatter::Step::Pending
          step.attention(pending_message, scenario.location)
        end
        steps
      end

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

      private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turnip_formatter-0.0.1 lib/turnip_formatter/scenario/pending.rb