Class: TestLauncher::Queries::ExampleNameQuery
Instance Attribute Summary
Attributes inherited from BaseQuery
#request
Instance Method Summary
collapse
Methods inherited from BaseQuery
#initialize
Instance Method Details
#command ⇒ Object
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/test_launcher/queries.rb', line 221
def command
return if test_cases.empty?
if one_example?
shell.notify("Found 1 example in 1 file.")
runner.single_example(test_cases.first)
elsif one_file?
shell.notify("Found #{test_cases.size} examples in 1 file.")
runner.multiple_examples_same_file(test_cases) elsif request.run_all?
shell.notify "Found #{pluralize(test_cases.size, "example")} in #{pluralize(file_count, "file")}."
runner.multiple_examples(test_cases)
else
shell.notify "Found #{pluralize(test_cases.size, "example")} in #{pluralize(file_count, "file")}."
shell.notify "Running most recently edited. Run with '--all' to run all the tests."
runner.single_example(most_recently_edited_test_case) end
end
|
#examples_found_by_name ⇒ Object
253
254
255
|
# File 'lib/test_launcher/queries.rb', line 253
def examples_found_by_name
@examples_found_by_name ||= searcher.examples(request.search_string)
end
|
#one_example? ⇒ Boolean
257
258
259
|
# File 'lib/test_launcher/queries.rb', line 257
def one_example?
test_cases.size == 1
end
|
#test_cases ⇒ Object
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/test_launcher/queries.rb', line 240
def test_cases
@test_cases ||= begin
examples_found_by_name.map { |grep_result|
request.test_case(
file: grep_result[:file],
example: request.search_string,
line_number: grep_result[:line_number],
request: request
)
}
end
end
|