Sha256: c6c20f5c2ba13036911a93ed35b827db065af4b83661cb7e930c6c6d9b1450bf
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# -*- coding: utf-8 -*- require 'turnip_formatter/scenario' require 'turnip_formatter/step/failure' require 'rspec/core/formatters/helpers' module TurnipFormatter module Scenario class NotFailedScenarioError < ::StandardError; end class NoExistFailedStepInformationError < ::StandardError; end class Failure include TurnipFormatter::Scenario include RSpec::Core::BacktraceFormatter def steps steps = super steps[offending_line].tap do |step| step.extend TurnipFormatter::Step::Failure step.attention(exception, backtrace) end steps end def validation raise NotFailedScenarioError if (status != 'failed') offending_line super end private def offending_line unless backtrace.last =~ /:in step:(?<stepno>\d+) `/ raise NoExistFailedStepInformationError end $~[:stepno].to_i end def backtrace @backtrace ||= format_backtrace(exception.backtrace, scenario.metadata).map do |b| backtrace_line(b) end.compact 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/failure.rb |