Class: Crystalball::Predictor::ModifiedSpecs
- Inherits:
-
Object
- Object
- Crystalball::Predictor::ModifiedSpecs
- Includes:
- Strategy
- Defined in:
- lib/crystalball/predictor/modified_specs.rb
Overview
Used with ‘predictor.use Crystalball::Predictor::ModifiedSpecs.new`. Will find files that match spec regexp and return all new or modified files. You can specify spec regexp using first parameter to `#initialize`.
Instance Method Summary collapse
-
#call(diff, _) ⇒ Array<String>
This strategy does not depend on a previously generated example group map.
-
#initialize(spec_pattern = %r{spec/.*_spec\.rb\z}) ⇒ ModifiedSpecs
constructor
A new instance of ModifiedSpecs.
Methods included from Helpers::PathFormatter
Constructor Details
#initialize(spec_pattern = %r{spec/.*_spec\.rb\z}) ⇒ ModifiedSpecs
Returns a new instance of ModifiedSpecs.
13 14 15 |
# File 'lib/crystalball/predictor/modified_specs.rb', line 13 def initialize(spec_pattern = %r{spec/.*_spec\.rb\z}) @spec_pattern = spec_pattern end |
Instance Method Details
#call(diff, _) ⇒ Array<String>
This strategy does not depend on a previously generated example group map. It uses the spec pattern to determine which specs should run.
22 23 24 25 26 |
# File 'lib/crystalball/predictor/modified_specs.rb', line 22 def call(diff, _) super do diff.reject(&:deleted?).map(&:new_relative_path).grep(spec_pattern) end end |