Class: Polyrun::Quick::ExampleRunner
- Inherits:
-
Object
- Object
- Polyrun::Quick::ExampleRunner
- Includes:
- Assertions, Matchers
- Defined in:
- lib/polyrun/quick/example_runner.rb
Overview
Per-example execution: merged lets, hooks, assertions, optional Capybara::DSL.
Instance Method Summary collapse
-
#initialize(reporter) ⇒ ExampleRunner
constructor
A new instance of ExampleRunner.
- #run(group_name:, description:, ancestor_chain:, block:) ⇒ Object
Methods included from Matchers
#be_falsey, #be_truthy, #eq, #expect, #include, #match
Methods included from Assertions
#assert, #assert_equal, #assert_nil, #assert_raises
Constructor Details
#initialize(reporter) ⇒ ExampleRunner
Returns a new instance of ExampleRunner.
12 13 14 15 |
# File 'lib/polyrun/quick/example_runner.rb', line 12 def initialize(reporter) @reporter = reporter @_let_cache = {} end |
Instance Method Details
#run(group_name:, description:, ancestor_chain:, block:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/polyrun/quick/example_runner.rb', line 17 def run(group_name:, description:, ancestor_chain:, block:) @_let_cache = {} merge_lets_from_chain(ancestor_chain) define_let_methods! run_let_bangs_from_chain begin run_before_hooks_from_chain(ancestor_chain) instance_eval(&block) @reporter.pass(group_name, description) rescue AssertionFailed => e @reporter.fail(group_name, description, e) rescue => e @reporter.error(group_name, description, e) ensure run_after_hooks_from_chain(ancestor_chain) @_let_cache = {} end end |