Class: TestFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/sfb_scripts/test_running/test_finder.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, query) ⇒ TestFinder

Returns a new instance of TestFinder.



8
9
10
11
12
13
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 8

def initialize(env, query)
  @shell = env[:shell]
  @repo = env[:repo]
  @query = query
  @regex_searches = {}
end

Instance Attribute Details

#queryObject

Returns the value of attribute query.



7
8
9
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 7

def query
  @query
end

#repoObject

Returns the value of attribute repo.



7
8
9
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 7

def repo
  @repo
end

#shellObject

Returns the value of attribute shell.



7
8
9
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 7

def shell
  @shell
end

Class Method Details

.find(query, env) ⇒ Object



3
4
5
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 3

def self.find(query, env)
  new(env, query).find
end

Instance Method Details

#findObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sfb_scripts/test_running/test_finder.rb', line 15

def find
  return tests_found_by_absolute_path if query.match(Repo.root_dir)

  return tests_found_by_name if tests_found_by_name.present?

  return tests_found_by_file_name if tests_found_by_file_name.present?

  return tests_found_by_full_regex if tests_found_by_full_regex.present?

  return TestCollection.new
end