module ATMFormatter::Example
Public Instance Methods
step(step, _options = {}) { |block| ... }
click to toggle source
# File lib/atm_formatter/steps.rb, line 3 def step(step, _options = {}, &block) @metadata[:steps] = [] if @metadata[:steps].nil? if RSpec.configuration.dry_run? @metadata[:steps].push(step_name: step, index: @metadata[:step_index]) else begin yield block @metadata[:steps].push(step_name: step, index: @metadata[:step_index], status: 'Pass') rescue => e @metadata[:steps].push(step_name: step, index: @metadata[:step_index], status: 'Fail', comment: process_exception(e)) raise end end ensure @metadata[:step_index] += 1 if @metadata.key?(:step_index) end
Private Instance Methods
format_exception(exception)
click to toggle source
# File lib/atm_formatter/steps.rb, line 25 def format_exception(exception) exception.failures.join('<br />').gsub("\n", '<br />') end
process_exception(exception)
click to toggle source
# File lib/atm_formatter/steps.rb, line 21 def process_exception(exception) exception.is_a?(RSpec::Expectations::MultipleExpectationsNotMetError) ? format_exception(exception) : exception end