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.
15 16 17 18 |
# File 'lib/polyrun/quick/example_runner.rb', line 15 def initialize(reporter) @reporter = reporter @_let_cache = {} end |
Instance Method Details
#run(group_name:, description:, ancestor_chain:, block:) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/polyrun/quick/example_runner.rb', line 20 def run(group_name:, description:, ancestor_chain:, block:) @_let_cache = {} merge_lets_from_chain(ancestor_chain) define_let_methods! run_let_bangs_from_chain qloc = quick_example_location(block) Polyrun::WorkerPing.ping!(location: qloc) 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 = {} Polyrun::WorkerPing.ping!(location: qloc) end end |