Class: TestLauncher::Queries::PathQuery

Inherits:
BaseQuery
  • Object
show all
Defined in:
lib/test_launcher/queries.rb

Instance Attribute Summary

Attributes inherited from BaseQuery

#request

Instance Method Summary collapse

Methods inherited from BaseQuery

#initialize

Constructor Details

This class inherits a constructor from TestLauncher::Queries::BaseQuery

Instance Method Details

#commandObject



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/test_launcher/queries.rb', line 193

def command
  return if test_cases.empty?

  if one_file?
    shell.notify "Found #{pluralize(file_count, "file")}."
    runner.single_file(test_cases.first)
  elsif request.run_all?
    shell.notify "Found #{pluralize(file_count, "file")}."
    runner.multiple_files(test_cases)
  else
    shell.notify "Found #{pluralize(file_count, "file")}."
    shell.notify "Running most recently edited. Run with '--all' to run all the tests."
    runner.single_file(most_recently_edited_test_case)
  end
end

#files_found_by_pathObject



215
216
217
# File 'lib/test_launcher/queries.rb', line 215

def files_found_by_path
  @files_found_by_path ||= searcher.test_files(request.search_string)
end

#test_casesObject



209
210
211
212
213
# File 'lib/test_launcher/queries.rb', line 209

def test_cases
  @test_cases ||= files_found_by_path.map { |file_path|
    request.test_case(file: file_path, request: request)
  }
end