Class: Crystalball::MapGenerator::CoverageStrategy
- Inherits:
-
Object
- Object
- Crystalball::MapGenerator::CoverageStrategy
- Includes:
- BaseStrategy
- Defined in:
- lib/crystalball/map_generator/coverage_strategy.rb,
lib/crystalball/map_generator/coverage_strategy/execution_detector.rb
Overview
Map generator strategy based on harvesting Coverage information during example execution
Defined Under Namespace
Classes: ExecutionDetector
Instance Attribute Summary collapse
-
#execution_detector ⇒ Object
readonly
Returns the value of attribute execution_detector.
Instance Method Summary collapse
- #after_register ⇒ Object
-
#call(example_map, example) {|example_map, example| ... } ⇒ Object
Adds to the example_map’s used files the ones the ones in which the coverage has changed after the tests runs.
-
#initialize(execution_detector = ExecutionDetector.new) ⇒ CoverageStrategy
constructor
A new instance of CoverageStrategy.
Methods included from BaseStrategy
#after_start, #before_finalize
Constructor Details
#initialize(execution_detector = ExecutionDetector.new) ⇒ CoverageStrategy
Returns a new instance of CoverageStrategy.
15 16 17 |
# File 'lib/crystalball/map_generator/coverage_strategy.rb', line 15 def initialize(execution_detector = ExecutionDetector.new) @execution_detector = execution_detector end |
Instance Attribute Details
#execution_detector ⇒ Object (readonly)
Returns the value of attribute execution_detector.
13 14 15 |
# File 'lib/crystalball/map_generator/coverage_strategy.rb', line 13 def execution_detector @execution_detector end |
Instance Method Details
#after_register ⇒ Object
19 20 21 |
# File 'lib/crystalball/map_generator/coverage_strategy.rb', line 19 def after_register Coverage.start end |
#call(example_map, example) {|example_map, example| ... } ⇒ Object
Adds to the example_map’s used files the ones the ones in which the coverage has changed after the tests runs.
27 28 29 30 31 32 |
# File 'lib/crystalball/map_generator/coverage_strategy.rb', line 27 def call(example_map, example) before = Coverage.peek_result yield example_map, example after = Coverage.peek_result example_map.push(*execution_detector.detect(before, after)) end |