Class: Properb::TestRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/properb.rb

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ TestRunner

Returns a new instance of TestRunner.



29
30
31
# File 'lib/properb.rb', line 29

def initialize(block)
  @block = block
end

Instance Method Details

#run(values) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/properb.rb', line 33

def run(values)
  @block.call(values)
  true
rescue Properb::RSpec::ExampleMethods::AssumptionViolated
  # These don't count as failures, but they also need to be run
  # again
  false
rescue AllExceptionsExceptOnesWeMustNotRescue => e
  string = values.map { |k, v| "#{k} = #{v.inspect}" }.join("\n            ")
  # Don't leave properb lines in the backtrace - they're not very useful.
  raise e, "    \#{e.message}\n\n    with input: \#{string}\n  MESSAGE\nend\n", e.backtrace.reject { %r{spec/properb\.rb}.match(_1) }