Module: Pbt::Check::RunnerMethods
Overview
Module to be
Instance Method Summary collapse
-
#assert(**options, &property) ⇒ void
Run a property based test and report its result.
-
#check(**options, &property) ⇒ RunDetails
Run a property based test and return its result.
Methods included from Tosser
Instance Method Details
#assert(**options, &property) ⇒ void
This method returns an undefined value.
Run a property based test and report its result.
21 22 23 24 |
# File 'lib/pbt/check/runner_methods.rb', line 21 def assert(**, &property) out = check(**, &property) Reporter::RunDetailsReporter.new(out).report_run_details end |
#check(**options, &property) ⇒ RunDetails
Run a property based test and return its result. This doesn’t throw contrary to ‘assert`. Use `assert` unless you want to handle the result.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/pbt/check/runner_methods.rb', line 35 def check(**, &property) property = property.call config = Pbt.configuration.to_h.merge(.to_h) initial_values = toss(property, config[:seed]) source_values = Enumerator.new(config[:num_runs]) do |y| config[:num_runs].times do y.yield initial_values.next end end suppress_exception_report_for_ractor(config) do run_it(property, source_values, config).to_run_details(config) end end |