Class: TestLauncher::Queries::ExampleNameQuery
- Defined in:
- lib/test_launcher/queries.rb
Instance Attribute Summary
Attributes inherited from BaseQuery
Instance Method Summary collapse
Methods inherited from BaseQuery
Constructor Details
This class inherits a constructor from TestLauncher::Queries::BaseQuery
Instance Method Details
#command ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/test_launcher/queries.rb', line 240 def command return if test_cases.empty? if one_example? { notifies: ["Found 1 example in 1 file."], command: runner.single_example(test_cases.first) } elsif one_file? { notifies: ["Found #{test_cases.size} examples in 1 file."], command: runner.multiple_examples_same_file(test_cases) # it will regex with the query } elsif request.run_all? { notifies: ["Found #{pluralize(test_cases.size, "example")} in #{pluralize(file_count, "file")}."], command: runner.multiple_examples(test_cases) } else { notifies: [ "Found #{pluralize(test_cases.size, "example")} in #{pluralize(file_count, "file")}.", "Running most recently edited. Run with '--all' to run all the tests.", ], command: runner.single_example(most_recently_edited_test_case) # let it regex the query } end end |
#examples_found_by_name ⇒ Object
282 283 284 |
# File 'lib/test_launcher/queries.rb', line 282 def examples_found_by_name @examples_found_by_name ||= searcher.examples(request.search_string) end |
#one_example? ⇒ Boolean
286 287 288 |
# File 'lib/test_launcher/queries.rb', line 286 def one_example? test_cases.size == 1 end |
#test_cases ⇒ Object
269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/test_launcher/queries.rb', line 269 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 |