Class: Crystalball::Predictor::ModifiedSupportSpecs
- Inherits:
-
Object
- Object
- Crystalball::Predictor::ModifiedSupportSpecs
- Includes:
- Helpers::AffectedExampleGroupsDetector, Strategy
- Defined in:
- lib/crystalball/predictor/modified_support_specs.rb
Overview
Used with ‘predictor.use Crystalball::Predictor::ModifiedSupportSpecs.new`. Will find files that match passed regexp and return full spec files which uses matched support spec files. Perfectly works for shared_context and shared_examples.
Instance Method Summary collapse
-
#call(diff, map) ⇒ Array<String>
The spec paths associated with the changes.
-
#initialize(support_spec_pattern = %r{spec/support/.*\.rb\z}) ⇒ ModifiedSupportSpecs
constructor
A new instance of ModifiedSupportSpecs.
Methods included from Helpers::AffectedExampleGroupsDetector
Methods included from Helpers::PathFormatter
Constructor Details
#initialize(support_spec_pattern = %r{spec/support/.*\.rb\z}) ⇒ ModifiedSupportSpecs
Returns a new instance of ModifiedSupportSpecs.
15 16 17 |
# File 'lib/crystalball/predictor/modified_support_specs.rb', line 15 def initialize(support_spec_pattern = %r{spec/support/.*\.rb\z}) @support_spec_pattern = support_spec_pattern end |
Instance Method Details
#call(diff, map) ⇒ Array<String>
Returns the spec paths associated with the changes.
24 25 26 27 28 29 30 31 32 |
# File 'lib/crystalball/predictor/modified_support_specs.rb', line 24 def call(diff, map) super do changed_support_files = diff.map(&:relative_path).grep(support_spec_pattern) examples = detect_examples(changed_support_files, map) examples.map { |e| e.to_s.split('[').first }.uniq end end |