Class: Pbt::Reporter::RunDetailsReporter
- Inherits:
-
Object
- Object
- Pbt::Reporter::RunDetailsReporter
- Defined in:
- lib/pbt/reporter/run_details_reporter.rb
Overview
Reporter for the run details of a property test.
Instance Method Summary collapse
-
#initialize(run_details) ⇒ RunDetailsReporter
constructor
A new instance of RunDetailsReporter.
-
#report_run_details ⇒ Object
Report the run details of a property test.
Constructor Details
#initialize(run_details) ⇒ RunDetailsReporter
Returns a new instance of RunDetailsReporter.
8 9 10 |
# File 'lib/pbt/reporter/run_details_reporter.rb', line 8 def initialize(run_details) @run_details = run_details end |
Instance Method Details
#report_run_details ⇒ Object
Report the run details of a property test. If the property test failed, raise a PropertyFailure.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pbt/reporter/run_details_reporter.rb', line 16 def report_run_details if @run_details.failed = [] << <<~EOS Property failed after #{@run_details.num_runs} test(s) { seed: #{@run_details.seed} } Counterexample: #{@run_details.counterexample} Shrunk #{@run_details.num_shrinks} time(s) Got #{@run_details.error_instance.class}: #{@run_details.} EOS if @run_details.verbose << " \n#{@run_details.error_instance.backtrace_locations.join("\n ")}" << "\nEncountered failures were:" << @run_details.failures.map { |f| "- #{f.val}" } end raise PropertyFailure, .join("\n") if .size > 0 end end |