Class: TurnipFormatter::Resource::Scenario::Failure
- Defined in:
- lib/turnip_formatter/resource/scenario/failure.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#mark_status ⇒ Object
Mark status for each step.
Methods inherited from Base
#backgrounds, #feature, #feature_info, #id, #initialize, #run_time, #status, #steps, #tags
Constructor Details
This class inherits a constructor from TurnipFormatter::Resource::Scenario::Base
Instance Method Details
#mark_status ⇒ Object
Mark status for each step
example:
When foo
And bar <= failed line
Then baz
# @steps => [
# <Step::Step 'foo'> # .status => :passed
# <Step::Step 'bar'> # .status => :failed
# <Step::Step 'baz'> # .status => :unexecute
# ]
example: aggregate_failures = true
# @steps => [
# <Step::Step 'foo'> # .status => :passed
# <Step::Step 'bar'> # .status => :failed
# <Step::Step 'baz'> # .status => :passed
# ]
example: Occurs error in RSpec before hook
# @steps => [
# <Step::BeforeHook ''> # .status => :failed
# <Step::Step 'foo'> # .status => :unexecute
# <Step::Step 'bar'> # .status => :unexecute
# <Step::Step 'baz'> # .status => :unexecute
# ]
example: Occurs error in RSpec after hook
# @steps => [
# <Step::Step 'foo'> # .status => :passed
# <Step::Step 'bar'> # .status => :failed
# <Step::Step 'baz'> # .status => :unexecute
# <Step::AfterHook ''> # .status => :failed
# ]
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/turnip_formatter/resource/scenario/failure.rb', line 49 def mark_status exceptions = all_exception_group_by_line_number if exceptions.has_key?(:before) before_step = TurnipFormatter::Resource::Step::BeforeHook.new(example) before_step.set_exceptions(exceptions[:before]) @steps.unshift(before_step) return end @steps.each do |step| step.mark_as_executed exs = exceptions[step.line] next unless exs step.set_exceptions(exs) break if !example.[:aggregate_failures] end if exceptions.has_key?(:after) after_step = TurnipFormatter::Resource::Step::AfterHook.new(example) after_step.set_exceptions(exceptions[:after]) @steps.push(after_step) end end |