Class: TestLauncher::Queries::FullRegexQuery
Instance Attribute Summary
Attributes inherited from BaseQuery
#request
Instance Method Summary
collapse
Methods inherited from BaseQuery
#initialize
Instance Method Details
#command ⇒ Object
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/test_launcher/queries.rb', line 305
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 ⇒ Object
333
334
335
336
337
338
339
|
# File 'lib/test_launcher/queries.rb', line 333
def files_found
if files_found_by_full_regex.any?
files_found_by_full_regex
else
files_found_by_joining_terms
end
end
|
#files_found_by_full_regex ⇒ Object
341
342
343
|
# File 'lib/test_launcher/queries.rb', line 341
def files_found_by_full_regex
@files_found_by_full_regex ||= searcher.grep(request.search_string)
end
|
#files_found_by_joining_terms ⇒ Object
345
346
347
348
349
|
# File 'lib/test_launcher/queries.rb', line 345
def files_found_by_joining_terms
return [] unless request.search_string.include?(" ")
joined_query = request.search_string.squeeze(" ").gsub(" ", "|")
@files_found_by_joining_terms ||= searcher.grep(joined_query)
end
|
#test_cases ⇒ Object
321
322
323
324
325
326
327
328
329
330
331
|
# File 'lib/test_launcher/queries.rb', line 321
def test_cases
@test_cases ||=
files_found
.uniq { |grep_result| grep_result[:file] }
.map { |grep_result|
request.test_case(
file: grep_result[:file],
request: request
)
}
end
|