module Unstoppable::Helpers
Attributes
errors[RW]
failures[RW]
Public Instance Methods
setup_unstoppable()
click to toggle source
# File lib/unstoppable/helpers.rb, line 5 def setup_unstoppable @failures ||=[] @errors ||=[] end
unstoppable() { || ... }
click to toggle source
# File lib/unstoppable/helpers.rb, line 10 def unstoppable begin yield rescue => error handle_error(error) end end
unstoppable_errors(scenario)
click to toggle source
# File lib/unstoppable/helpers.rb, line 29 def unstoppable_errors(scenario) output = 'No Errors' unless errors.empty? output = errors.reduce("Errors for scenario: #{scenario.name}\n") do |memo, error| memo << "#{error}\n" memo end end output end
unstoppable_failures(scenario)
click to toggle source
# File lib/unstoppable/helpers.rb, line 18 def unstoppable_failures(scenario) output = 'No Failures' unless failures.empty? output = failures.reduce("Failures for scenario: #{scenario.name}\n") do |memo, failure| memo << "#{failure}\n" memo end end output end
Private Instance Methods
handle_error(error)
click to toggle source
# File lib/unstoppable/helpers.rb, line 41 def handle_error(error) log_error(error) if error.class == RSpec::Expectations::ExpectationNotMetError failures.push(error) else errors.push(error) end end
log_error(error)
click to toggle source
# File lib/unstoppable/helpers.rb, line 50 def log_error(error) File.open("#{Dir.pwd}/unstoppable.log", 'a') do |f| f.write("#{error}\n") end end