lib/rantly/property.rb in rantly-2.0.0 vs lib/rantly/property.rb in rantly-3.0.0

- old
+ new

@@ -3,16 +3,16 @@ require 'stringio' class Rantly::Property attr_reader :failed_data, :shrunk_failed_data - VERBOSITY = ENV.fetch('RANTLY_VERBOSE') { 1 }.to_i - RANTLY_COUNT = ENV.fetch('RANTLY_COUNT') { 100 }.to_i + VERBOSITY = ENV.fetch('RANTLY_VERBOSE', 1).to_i + RANTLY_COUNT = ENV.fetch('RANTLY_COUNT', 100).to_i def io @io ||= if VERBOSITY >= 1 - STDOUT + $stdout else StringIO.new end end @@ -39,20 +39,20 @@ io.puts "SUCCESS - #{i} successful tests" rescue Rantly::TooManyTries => e io.puts io.puts "FAILURE - #{i} successful tests, too many tries: #{e.tries}" raise e.exception("#{i} successful tests, too many tries: #{e.tries} (limit: #{e.limit})") - rescue Exception => boom + rescue Exception => e io.puts io.puts "FAILURE - #{i} successful tests, failed on:" pretty_print test_data @failed_data = test_data if @failed_data.respond_to?(:shrink) @shrunk_failed_data, @depth = shrinkify(assertion, @failed_data) io.puts "Minimal failed data (depth #{@depth}) is:" pretty_print @shrunk_failed_data end - raise boom.exception("#{i} successful tests, failed on:\n#{test_data}\n\n#{boom}\n") + raise e.exception("#{i} successful tests, failed on:\n#{test_data}\n\n#{e}\n") end end # Explore the failures tree def shrinkify(assertion, data, depth = 0, iteration = 0)