Class: Opal::RSpec::AsyncRunner
- Inherits:
-
Object
- Object
- Opal::RSpec::AsyncRunner
- Defined in:
- opal/opal/rspec/async.rb
Overview
Runs all async examples from Opal::RSpec::AsyncExample.examples.
Instance Method Summary collapse
- #example_finished(example) ⇒ Object
-
#finish ⇒ Object
Called once all examples have finished.
-
#initialize(runner, reporter, finish_block) ⇒ AsyncRunner
constructor
A new instance of AsyncRunner.
- #run ⇒ Object
- #run_example(example) ⇒ Object
- #run_next_example ⇒ Object
Constructor Details
#initialize(runner, reporter, finish_block) ⇒ AsyncRunner
Returns a new instance of AsyncRunner.
147 148 149 150 151 |
# File 'opal/opal/rspec/async.rb', line 147 def initialize(runner, reporter, finish_block) @runner = runner @reporter = reporter @finish_block = finish_block end |
Instance Method Details
#example_finished(example) ⇒ Object
177 178 179 180 |
# File 'opal/opal/rspec/async.rb', line 177 def example_finished(example) @reporter.example_group_finished example.example_group run_next_example end |
#finish ⇒ Object
Called once all examples have finished. Just calls back to main runner to inform it
184 185 186 |
# File 'opal/opal/rspec/async.rb', line 184 def finish @finish_block.call end |
#run ⇒ Object
153 154 155 156 |
# File 'opal/opal/rspec/async.rb', line 153 def run @examples = AsyncExample.examples.clone run_next_example end |
#run_example(example) ⇒ Object
166 167 168 169 170 171 172 173 174 175 |
# File 'opal/opal/rspec/async.rb', line 166 def run_example(example) example_group = example.example_group @reporter.example_group_started example_group instance = example_group.new example.run(instance, @reporter) do example_finished example end end |
#run_next_example ⇒ Object
158 159 160 161 162 163 164 |
# File 'opal/opal/rspec/async.rb', line 158 def run_next_example if @examples.empty? finish else run_example @examples.pop end end |