Class: Retest::MatchingOptions
- Inherits:
-
Object
- Object
- Retest::MatchingOptions
- Defined in:
- lib/retest/matching_options.rb,
lib/retest/matching_options/path.rb
Defined Under Namespace
Classes: Path
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#test_directories ⇒ Object
readonly
Returns the value of attribute test_directories.
Class Method Summary collapse
Instance Method Summary collapse
- #filtered_results ⇒ Object
-
#initialize(path, files: [], limit: 5, test_directories: nil) ⇒ MatchingOptions
constructor
A new instance of MatchingOptions.
Constructor Details
#initialize(path, files: [], limit: 5, test_directories: nil) ⇒ MatchingOptions
Returns a new instance of MatchingOptions.
11 12 13 14 15 16 |
# File 'lib/retest/matching_options.rb', line 11 def initialize(path, files: [], limit: 5, test_directories: nil) @path = Path.new(path) @files = files @limit = limit || 5 @test_directories = (test_directories || %w[spec test]) + %w[.] # add root file as a valid test directory end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
9 10 11 |
# File 'lib/retest/matching_options.rb', line 9 def files @files end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/retest/matching_options.rb', line 9 def path @path end |
#test_directories ⇒ Object (readonly)
Returns the value of attribute test_directories.
9 10 11 |
# File 'lib/retest/matching_options.rb', line 9 def test_directories @test_directories end |
Class Method Details
.for(path, files: [], limit: nil) ⇒ Object
5 6 7 |
# File 'lib/retest/matching_options.rb', line 5 def self.for(path, files: [], limit: nil) new(path, files: files, limit: limit).filtered_results end |
Instance Method Details
#filtered_results ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/retest/matching_options.rb', line 18 def filtered_results if path.test?(test_directories: test_directories) [path] elsif (screened_tests = screen_namespaces(possible_tests)).any? screened_tests else possible_tests end.map(&:to_s) end |