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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
|
# File 'lib/test_launcher/queries.rb', line 296
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
324
325
326
327
328
329
330
|
# File 'lib/test_launcher/queries.rb', line 324
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
332
333
334
|
# File 'lib/test_launcher/queries.rb', line 332
def files_found_by_full_regex
@files_found_by_full_regex ||= searcher.grep(request.search_string)
end
|
#files_found_by_joining_terms ⇒ Object
336
337
338
339
|
# File 'lib/test_launcher/queries.rb', line 336
def files_found_by_joining_terms
joined_query = request.search_string.squeeze(" ").gsub(" ", "|")
@files_found_by_joining_terms ||= searcher.grep(joined_query)
end
|
#test_cases ⇒ Object
312
313
314
315
316
317
318
319
320
321
322
|
# File 'lib/test_launcher/queries.rb', line 312
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
|