test_launcher 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -7
  3. data/lib/test_launcher/frameworks/ex_unit.rb +1 -1
  4. data/lib/test_launcher/frameworks/minitest.rb +6 -6
  5. data/lib/test_launcher/frameworks/rspec.rb +3 -3
  6. data/lib/test_launcher/queries.rb +67 -6
  7. data/lib/test_launcher/version.rb +1 -1
  8. data/test/test_launcher/frameworks/minitest/runner_test.rb +2 -2
  9. data/test/test_launcher/frameworks/minitest/searcher_test.rb +1 -2
  10. data/test/test_launcher/minitest_integration_test.rb +86 -27
  11. data/test/test_launcher/queries/{multi_term_query_test.rb → multi_path_query_test.rb} +6 -6
  12. data/test/test_launcher/queries/search_query_test.rb +3 -3
  13. data/test/test_launcher/rspec_integration_test.rb +64 -4
  14. data/test/test_launcher/rubymine_test.rb +1 -1
  15. metadata +4 -28
  16. data/test/test_launcher/fixtures/minitest/Gemfile +0 -0
  17. data/test/test_launcher/fixtures/minitest/test/class_1_test.rb +0 -6
  18. data/test/test_launcher/fixtures/minitest/test/class_2_test.rb +0 -9
  19. data/test/test_launcher/fixtures/minitest/test/different_root/Gemfile +0 -0
  20. data/test/test_launcher/fixtures/minitest/test/different_root/bin/spring +0 -1
  21. data/test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb +0 -2
  22. data/test/test_launcher/fixtures/rspec/Gemfile +0 -0
  23. data/test/test_launcher/fixtures/rspec/spec/class_1_spec.rb +0 -16
  24. data/test/test_launcher/fixtures/rspec/spec/class_2_spec.rb +0 -6
  25. data/test/test_launcher/fixtures/rspec/spec/different_root/Gemfile +0 -0
  26. data/test/test_launcher/fixtures/rspec/spec/different_root/spec/different_root_spec.rb +0 -2
  27. data/test/test_launcher/queries/single_term_query_test.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccdfde0aec34dd6c9644f3985b2fec6c8b80d65a
4
- data.tar.gz: a580b9f1354854325582f98d02a42626065cca23
3
+ metadata.gz: ee375d2d54fa4515002e279d1be2d1311265ef15
4
+ data.tar.gz: 45d2b818b60b50a9b1a973b41cba18ad49d79518
5
5
  SHA512:
6
- metadata.gz: 264cb91173593078f956c8a76e527494cd033a3d647d31d1527528eef1afb84d0273707004c55d0057bfdc7f15411384be3da46af1197d942fb05a8ee55b1be7
7
- data.tar.gz: 509301a76e17513abaeb8952230a43844392f09ca0d7ae520b8909faedde428a485bf02c44ba40b17c5a9ee371f0890eae053bfd56ea1996d1fc7984aed02241
6
+ metadata.gz: a2eba4180a96e7ddb178ff3516106cb1ad600782f864b8c0f5125cc19950610e3d593d99bf1f6febbf690d3bb3346096953061928682a34f76bb1084b27525c1
7
+ data.tar.gz: 9452932c5136e3fd33d7616c65d33d52a992df0e1f397e7618a2180c1eaa2b6f8c20dfce23eec1053420a18cbb279e57bff83226b4c4e408212ac60cd55b792a
data/README.md CHANGED
@@ -95,11 +95,18 @@ test_launcher blog_post_test.rb comment_test.rb
95
95
 
96
96
  #=> ruby -I test -e 'ARGV.each {|f| require(f)}' test/models/blog_post_test.rb test/models/comment_test.rb
97
97
  ```
98
+ Or maybe you've got multiple test methods you want to run:
99
+
100
+ ```
101
+ test_launcher test_name_1 test_name_2
102
+
103
+ #=> ruby -I test -e "ARGV.push('--name=/test_name_1|test_name_2/')" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb
104
+ ```
98
105
 
99
106
  Or maybe you'd like to run all test methods that match a regular expression:
100
107
 
101
108
  ```
102
- test_launcher 'hello_\w*|goodbye_\w+'
109
+ test_launcher 'hello_\w*|goodbye_\w+' --all
103
110
 
104
111
  #=> Found 2 methods in 2 files.
105
112
  #=> bundle exec ruby -I test -e "ARGV.push('--name=/hello_\w*|goodbye_\w+/')" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb
@@ -149,7 +156,7 @@ Suppose you type `test_launcher thing`. It will run tests using this priority p
149
156
  1. Any test file based on a generic search
150
157
  - runs `stuff_test.rb` because it found the word `thing` inside of it
151
158
 
152
- If your looks like it's specifying a line number (e.g. `file_test.rb:17`), that search will be preferred.
159
+ If your query looks like it's specifying a line number (e.g. `file_test.rb:17`), that search will be preferred.
153
160
 
154
161
  Any time it matches multiple files, it will default to running the most recently edited file. You can append `--all` if you want to run all matching tests, even if they are in different engines/gems!
155
162
 
@@ -167,9 +174,8 @@ If you've already committed your changes, but want to double check before you pu
167
174
  ```
168
175
  git diff --name-only --diff-filter=ACMTUXB origin/master | grep _test.rb | xargs test_launcher
169
176
  ```
170
- (see https://git-scm.com/docs/git-diff)
171
-
172
177
 
178
+ Add this to your `~/.bash_profile` and enjoy!
173
179
  ```
174
180
  function tdiff()
175
181
  {
@@ -253,14 +259,14 @@ $:time test_launcher something_that_no_test_says
253
259
 
254
260
  #=> real 0m2.214s
255
261
  #=> user 0m1.407s
256
- #=> sys 0m1.062s
262
+ #=> sys 0m1.062s
257
263
 
258
- $:time NOEXEC_DISABLE=1 test_launcher something_that_no_test_might_say
264
+ $:time NOEXEC_DISABLE=1 test_launcher something_that_no_test_says
259
265
  #=> Could not find any tests.
260
266
 
261
267
  #=> real 0m1.412s
262
268
  #=> user 0m0.745s
263
- #=> sys 0m0.945s
269
+ #=> sys 0m0.945s
264
270
  ```
265
271
 
266
272
  I suggest that if you are using RVM, you may as well make this your alias:
@@ -44,7 +44,7 @@ module TestLauncher
44
44
  end
45
45
 
46
46
  def example_name_regex(query="")
47
- "^\s*test\s+\".*#{query}.*\"\s+do"
47
+ "^\s*test\s+\".*(#{query}).*\"\s+do"
48
48
  end
49
49
  end
50
50
 
@@ -64,9 +64,9 @@ module TestLauncher
64
64
 
65
65
  def example_name_regex(query="")
66
66
  if query.match(/^test_/)
67
- "^\s*def\s+#{query}.*"
67
+ "^\s*def\s+(#{query}).*"
68
68
  else
69
- "^\s*def\s+test_.*#{query}.*"
69
+ "^\s*def\s+test_.*(#{query }).*"
70
70
  end
71
71
  end
72
72
 
@@ -96,12 +96,12 @@ Open an issue on https://github.com/petekinnecom/test_launcher if this is someth
96
96
  def single_example(test_case, name: test_case.example, exact_match: false)
97
97
  name_arg =
98
98
  if exact_match
99
- Shellwords.escape(name)
99
+ name
100
100
  else
101
- "/#{Shellwords.escape(name)}/"
101
+ "/#{name}/"
102
102
  end
103
103
 
104
- %{cd #{test_case.app_root} && #{test_case.example_runner} #{test_case.file} --name=#{name_arg}}
104
+ %{cd #{test_case.app_root} && #{test_case.example_runner} #{test_case.file} --name='#{name_arg}'}
105
105
  end
106
106
 
107
107
  def multiple_examples_same_file(test_cases)
@@ -110,7 +110,7 @@ Open an issue on https://github.com/petekinnecom/test_launcher if this is someth
110
110
  end
111
111
 
112
112
  def multiple_examples_same_root(test_cases)
113
- %{cd #{test_cases.first.app_root} && bundle exec ruby -I test -e "ARGV.push('--name=/#{test_cases.first.example}/')" #{test_cases.map {|tc| "-r #{tc.file}"}.uniq.join(" ")}}
113
+ %{cd #{test_cases.first.app_root} && bundle exec ruby -I test -r bundler/setup -e "ARGV.push('--name=/#{test_cases.first.example}/')" #{test_cases.map {|tc| "-r #{tc.file}"}.uniq.join(" ")}}
114
114
  end
115
115
 
116
116
  def one_or_more_files(test_cases)
@@ -45,7 +45,7 @@ module TestLauncher
45
45
  end
46
46
 
47
47
  def example_name_regex(query)
48
- "^\s*(it|context|(RSpec.)?describe) .*#{query}.* do.*"
48
+ "^\s*(it|context|(RSpec.)?describe) .*(#{query}).* do.*"
49
49
  end
50
50
  end
51
51
 
@@ -55,7 +55,7 @@ module TestLauncher
55
55
  end
56
56
 
57
57
  def single_example(test_case, **_)
58
- %{cd #{test_case.app_root} && bundle exec rspec #{test_case.file} --example #{Shellwords.escape(test_case.example)}}
58
+ multiple_examples_same_root([test_case])
59
59
  end
60
60
 
61
61
  def multiple_examples_same_file(test_cases)
@@ -64,7 +64,7 @@ module TestLauncher
64
64
  end
65
65
 
66
66
  def multiple_examples_same_root(test_cases)
67
- one_or_more_files(test_cases.uniq {|tc| tc.file})
67
+ %{cd #{test_cases.first.app_root} && bundle exec rspec #{test_cases.map(&:file).join(" ")} --example #{Shellwords.escape(test_cases.first.example)}}
68
68
  end
69
69
 
70
70
  def one_or_more_files(test_cases)
@@ -9,8 +9,8 @@ module TestLauncher
9
9
  commandify(SpecifiedNameQuery)
10
10
  end
11
11
 
12
- def multi_search_term
13
- commandify(MultiTermQuery)
12
+ def multi_path_query
13
+ commandify(MultiPathQuery)
14
14
  end
15
15
 
16
16
  def by_path
@@ -21,6 +21,10 @@ module TestLauncher
21
21
  commandify(ExampleNameQuery)
22
22
  end
23
23
 
24
+ def multi_example_name
25
+ commandify(MultiExampleNameQuery)
26
+ end
27
+
24
28
  def from_full_regex
25
29
  commandify(FullRegexQuery)
26
30
  end
@@ -137,7 +141,7 @@ module TestLauncher
137
141
  end
138
142
  end
139
143
 
140
- class MultiTermQuery < BaseQuery
144
+ class MultiPathQuery < BaseQuery
141
145
  def command
142
146
  return if test_cases.empty?
143
147
 
@@ -225,7 +229,7 @@ module TestLauncher
225
229
  end
226
230
 
227
231
  def test_cases
228
- @test_cases ||=
232
+ @test_cases ||= begin
229
233
  examples_found_by_name.map { |grep_result|
230
234
  request.test_case(
231
235
  file: grep_result[:file],
@@ -234,6 +238,7 @@ module TestLauncher
234
238
  request: request
235
239
  )
236
240
  }
241
+ end
237
242
  end
238
243
 
239
244
  def examples_found_by_name
@@ -245,6 +250,48 @@ module TestLauncher
245
250
  end
246
251
  end
247
252
 
253
+ class MultiExampleNameQuery < BaseQuery
254
+ def command
255
+ return if test_cases.empty?
256
+
257
+ if one_example?
258
+ shell.notify("Found 1 example in 1 file.")
259
+ runner.single_example(test_cases.first)
260
+ elsif one_file?
261
+ shell.notify("Found #{test_cases.size} examples in 1 file.")
262
+ runner.multiple_examples_same_file(test_cases) # it will regex with the query
263
+ else
264
+ shell.notify "Found #{pluralize(test_cases.size, "example")} in #{pluralize(file_count, "file")}."
265
+ runner.multiple_examples(test_cases)
266
+ end
267
+ end
268
+
269
+ def test_cases
270
+ return [] if joined_query == request.search_string
271
+
272
+ @test_cases_found_by_joining_query ||= examples_found.map { |grep_result|
273
+ request.test_case(
274
+ file: grep_result[:file],
275
+ example: joined_query,
276
+ line_number: grep_result[:line_number],
277
+ request: request
278
+ )
279
+ }
280
+ end
281
+
282
+ def examples_found
283
+ @examples_found_by_joining_query ||= searcher.examples(joined_query)
284
+ end
285
+
286
+ def joined_query
287
+ @joined_query ||= request.search_string.squeeze(" ").gsub(" ", "|")
288
+ end
289
+
290
+ def one_example?
291
+ test_cases.size == 1
292
+ end
293
+ end
294
+
248
295
  class FullRegexQuery < BaseQuery
249
296
  def command
250
297
  return if test_cases.empty?
@@ -264,7 +311,7 @@ module TestLauncher
264
311
 
265
312
  def test_cases
266
313
  @test_cases ||=
267
- files_found_by_full_regex
314
+ files_found
268
315
  .uniq { |grep_result| grep_result[:file] }
269
316
  .map { |grep_result|
270
317
  request.test_case(
@@ -274,9 +321,22 @@ module TestLauncher
274
321
  }
275
322
  end
276
323
 
324
+ def files_found
325
+ if files_found_by_full_regex.any?
326
+ files_found_by_full_regex
327
+ else
328
+ files_found_by_joining_terms
329
+ end
330
+ end
331
+
277
332
  def files_found_by_full_regex
278
333
  @files_found_by_full_regex ||= searcher.grep(request.search_string)
279
334
  end
335
+
336
+ def files_found_by_joining_terms
337
+ joined_query = request.search_string.squeeze(" ").gsub(" ", "|")
338
+ @files_found_by_joining_terms ||= searcher.grep(joined_query)
339
+ end
280
340
  end
281
341
 
282
342
  class LineNumberQuery < BaseQuery
@@ -323,6 +383,7 @@ module TestLauncher
323
383
  [
324
384
  :by_path,
325
385
  :example_name,
386
+ :multi_example_name,
326
387
  :from_full_regex,
327
388
  ]
328
389
  .each { |command_type|
@@ -336,7 +397,7 @@ module TestLauncher
336
397
  class SearchQuery < BaseQuery
337
398
  def command
338
399
  {
339
- multi_search_term: request.search_string.include?(" "),
400
+ multi_path_query: request.search_string.include?(" "),
340
401
  line_number: request.search_string.include?(":"),
341
402
  single_search_term: true
342
403
  }.each {|command_type, valid|
@@ -1,3 +1,3 @@
1
1
  module TestLauncher
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -18,7 +18,7 @@ module TestLauncher
18
18
  example_runner: "example_runner",
19
19
  file: "file"
20
20
  )
21
- assert_equal "cd app_root && example_runner file --name=/example_name/", Runner.new.single_example(test_case)
21
+ assert_equal "cd app_root && example_runner file --name='/example_name/'", Runner.new.single_example(test_case)
22
22
  end
23
23
 
24
24
  def test_multiple_examples_same_file
@@ -36,7 +36,7 @@ module TestLauncher
36
36
  file: "file"
37
37
  )
38
38
  ]
39
- assert_equal "cd app_root && example_runner file --name=/example_name/", Runner.new.multiple_examples_same_file(test_cases)
39
+ assert_equal "cd app_root && example_runner file --name='/example_name/'", Runner.new.multiple_examples_same_file(test_cases)
40
40
  end
41
41
 
42
42
  def test_single_file
@@ -13,7 +13,7 @@ module TestLauncher
13
13
  mocks Search::Git
14
14
 
15
15
  impl :grep do |regex, file_pattern:|
16
- example_name_regex = "^ *def +test_.*.*" #TODO: no bueno copying this
16
+ example_name_regex = "^ *def +test_.*().*" #TODO: no bueno copying this
17
17
  case [regex, file_pattern]
18
18
  when [example_name_regex, "test/test_launcher/single_test.rb"]
19
19
  [
@@ -34,7 +34,6 @@ module TestLauncher
34
34
  "test/dir/2_multiple_test.rb:30: def test__second",
35
35
  ]
36
36
  else
37
- require "pry";binding.pry
38
37
  raise "unmocked search: #{regex}, #{file_pattern}"
39
38
  end
40
39
  end
@@ -25,10 +25,10 @@ module TestLauncher
25
25
  end
26
26
 
27
27
  launch("test_name", searcher: searcher)
28
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name=/test_name/", shell_mock.recall_exec
28
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name='/test_name/'", shell_mock.recall_exec
29
29
 
30
30
  launch("n", searcher: searcher)
31
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name=/n/", shell_mock.recall_exec
31
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name='/n/'", shell_mock.recall_exec
32
32
  end
33
33
 
34
34
  def test__by_example__multiple_methods__same_file
@@ -48,7 +48,7 @@ module TestLauncher
48
48
  end
49
49
 
50
50
  launch("name_", searcher: searcher)
51
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name=/name_/", shell_mock.recall_exec
51
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name='/name_/'", shell_mock.recall_exec
52
52
  end
53
53
 
54
54
  def test__by_example__multiple_methods__regex_issue
@@ -71,7 +71,7 @@ module TestLauncher
71
71
  end
72
72
 
73
73
  launch("test_name", searcher: searcher)
74
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name=/test_name/", shell_mock.recall_exec
74
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name='/test_name/'", shell_mock.recall_exec
75
75
 
76
76
  skip
77
77
  # not seeing a good solution here...
@@ -79,7 +79,7 @@ module TestLauncher
79
79
  # might need to do two passes: first with user input, then
80
80
  # filter down to those that match test_...would that work?
81
81
  launch("_name", searcher: searcher)
82
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name=/test_name/", shell_mock.recall_exec
82
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_1_test.rb --name='/test_name/'", shell_mock.recall_exec
83
83
  end
84
84
 
85
85
  def test__by_example__multiple_methods__different_files
@@ -112,19 +112,19 @@ module TestLauncher
112
112
  end
113
113
 
114
114
  launch("name_1", searcher: searcher)
115
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_2_test.rb --name=/name_1/", shell_mock.recall_exec
115
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_2_test.rb --name='/name_1/'", shell_mock.recall_exec
116
116
 
117
117
  launch("name_2", searcher: searcher)
118
- assert_equal "cd /src && bundle exec ruby -I test /src/test/class_2_test.rb --name=/name_2/", shell_mock.recall_exec
118
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/class_2_test.rb --name='/name_2/'", shell_mock.recall_exec
119
119
 
120
120
  launch("name_1 --all", searcher: searcher)
121
- assert_equal "cd /src && bundle exec ruby -I test -e \"ARGV.push('--name=/name_1/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb", shell_mock.recall_exec
121
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/name_1/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb", shell_mock.recall_exec
122
122
 
123
123
  launch("name_2 --all", searcher: searcher)
124
- assert_equal "cd /src && bundle exec ruby -I test -e \"ARGV.push('--name=/name_2/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb -r /src/test/class_3_test.rb", shell_mock.recall_exec
124
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/name_2/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb -r /src/test/class_3_test.rb", shell_mock.recall_exec
125
125
 
126
126
  launch("name_1|name_2 --all", searcher: searcher)
127
- assert_equal "cd /src && bundle exec ruby -I test -e \"ARGV.push('--name=/name_1|name_2/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb -r /src/test/class_3_test.rb", shell_mock.recall_exec
127
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/name_1|name_2/')\" -r /src/test/class_1_test.rb -r /src/test/class_2_test.rb -r /src/test/class_3_test.rb", shell_mock.recall_exec
128
128
  end
129
129
 
130
130
  def test__by_filename
@@ -341,7 +341,66 @@ module TestLauncher
341
341
  end
342
342
 
343
343
  launch("regex_match", searcher: searcher)
344
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/regex_match/", shell_mock.recall_exec
344
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/regex_match/'", shell_mock.recall_exec
345
+ end
346
+
347
+ def test__multiple_queries__generic_regex__prefers_to_keep_spaces
348
+ searcher = MemorySearcher.new do |searcher|
349
+ searcher.mock_file do |f|
350
+ f.path "/src/test/file_1_test.rb"
351
+ f.mtime Time.new(2013, 01, 01, 00, 00, 00)
352
+ f.contents <<-RB
353
+ this matches
354
+ RB
355
+ end
356
+
357
+ searcher.mock_file do |f|
358
+ f.path "/src/test/file_2_test.rb"
359
+ f.mtime Time.new(2015, 01, 01, 00, 00, 00)
360
+ f.contents <<-RB
361
+ this
362
+ matches
363
+ RB
364
+ end
365
+
366
+ launch("this matches", searcher: searcher)
367
+ assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_1_test.rb", shell_mock.recall_exec
368
+
369
+ launch("this matches --all", searcher: searcher)
370
+ assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_1_test.rb", shell_mock.recall_exec
371
+
372
+ launch("matches this --all", searcher: searcher)
373
+ assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_1_test.rb /src/test/file_2_test.rb", shell_mock.recall_exec
374
+ end
375
+ end
376
+
377
+ def test__multiple_queries__splits_spaces_for_test_names
378
+ searcher = MemorySearcher.new do |searcher|
379
+ searcher.mock_file do |f|
380
+ f.path "/src/test/file_1_test.rb"
381
+ f.mtime Time.new(2013, 01, 01, 00, 00, 00)
382
+ f.contents <<-RB
383
+ def test_this
384
+ RB
385
+ end
386
+
387
+ searcher.mock_file do |f|
388
+ f.path "/src/test/file_2_test.rb"
389
+ f.mtime Time.new(2015, 01, 01, 00, 00, 00)
390
+ f.contents <<-RB
391
+ def test_matches
392
+ RB
393
+ end
394
+
395
+ launch("this matches", searcher: searcher)
396
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/this|matches/')\" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb", shell_mock.recall_exec
397
+
398
+ launch("this matches --all", searcher: searcher)
399
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/this|matches/')\" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb", shell_mock.recall_exec
400
+
401
+ launch("this matches", searcher: searcher)
402
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/this|matches/')\" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb", shell_mock.recall_exec
403
+ end
345
404
  end
346
405
 
347
406
  def test__helper_methods_are_considered_regexes
@@ -379,16 +438,16 @@ module TestLauncher
379
438
  end
380
439
 
381
440
  launch("test_name_1$", searcher: searcher)
382
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1\\$/", shell_mock.recall_exec
441
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1$/'", shell_mock.recall_exec
383
442
 
384
443
  launch("test_name_2|test_name_1", searcher: searcher)
385
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_2_test.rb --name=/test_name_2\\|test_name_1/", shell_mock.recall_exec
444
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_2_test.rb --name='/test_name_2|test_name_1/'", shell_mock.recall_exec
386
445
 
387
446
  launch('test_name_\d', searcher: searcher)
388
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_2_test.rb --name=/test_name_\\\\d/", shell_mock.recall_exec
447
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_2_test.rb --name='/test_name_\\d/'", shell_mock.recall_exec
389
448
 
390
449
  launch('test_name_\d --all', searcher: searcher)
391
- assert_equal "cd /src && bundle exec ruby -I test -e \"ARGV.push('--name=/test_name_\\d/')\" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb", shell_mock.recall_exec
450
+ assert_equal %{cd /src && bundle exec ruby -I test -r bundler/setup -e "ARGV.push('--name=/test_name_\\d/')" -r /src/test/file_1_test.rb -r /src/test/file_2_test.rb}, shell_mock.recall_exec
392
451
  end
393
452
 
394
453
  def test__not_found
@@ -434,10 +493,10 @@ module TestLauncher
434
493
  end
435
494
 
436
495
  launch("test_name_1", searcher: searcher)
437
- assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
496
+ assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
438
497
 
439
498
  launch("test_name_1 --all", searcher: searcher)
440
- assert_equal "cd /src && bundle exec ruby -I test -e \"ARGV.push('--name=/test_name_1/')\" -r /src/test/file_1_test.rb; cd -;\n\ncd /src/inline/gem && bundle exec ruby -I test -e \"ARGV.push('--name=/test_name_1/')\" -r /src/inline/gem/test/file_1_test.rb", shell_mock.recall_exec
499
+ assert_equal "cd /src && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/test_name_1/')\" -r /src/test/file_1_test.rb; cd -;\n\ncd /src/inline/gem && bundle exec ruby -I test -r bundler/setup -e \"ARGV.push('--name=/test_name_1/')\" -r /src/inline/gem/test/file_1_test.rb", shell_mock.recall_exec
441
500
 
442
501
  launch("file --all", searcher: searcher)
443
502
  assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_1_test.rb /src/test/file_2_test.rb; cd -;\n\ncd /src/inline/gem && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/inline/gem/test/file_1_test.rb", shell_mock.recall_exec
@@ -469,10 +528,10 @@ module TestLauncher
469
528
  end
470
529
 
471
530
  launch("file_1 --name test_name_1", searcher: searcher)
472
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
531
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
473
532
 
474
533
  launch("file_2 --name test_name_2", searcher: searcher)
475
- assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_2_test.rb --name=/test_name_2/", shell_mock.recall_exec
534
+ assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_2_test.rb --name='/test_name_2/'", shell_mock.recall_exec
476
535
  end
477
536
 
478
537
  def test__specified_example_name__multiple_files_same_name
@@ -495,7 +554,7 @@ module TestLauncher
495
554
  end
496
555
 
497
556
  launch("file_1 --name test_name_1", searcher: searcher)
498
- assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
557
+ assert_equal "cd /src/inline/gem && bundle exec ruby -I test /src/inline/gem/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
499
558
  end
500
559
 
501
560
  def test__by_line_number
@@ -521,25 +580,25 @@ module TestLauncher
521
580
  assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_1_test.rb", shell_mock.recall_exec
522
581
 
523
582
  launch("file_1_test.rb:2", searcher: searcher)
524
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
583
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
525
584
 
526
585
  launch("file_1_test.rb:3", searcher: searcher)
527
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
586
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
528
587
 
529
588
  launch("file_1_test.rb:4", searcher: searcher)
530
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
589
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
531
590
 
532
591
  launch("file_1_test.rb:5", searcher: searcher)
533
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_1/", shell_mock.recall_exec
592
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_1/'", shell_mock.recall_exec
534
593
 
535
594
  launch("file_1_test.rb:6", searcher: searcher)
536
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_2/", shell_mock.recall_exec
595
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_2/'", shell_mock.recall_exec
537
596
 
538
597
  launch("file_1_test.rb:7", searcher: searcher)
539
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_2/", shell_mock.recall_exec
598
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_2/'", shell_mock.recall_exec
540
599
 
541
600
  launch("file_1_test.rb:8", searcher: searcher)
542
- assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name=/test_name_2/", shell_mock.recall_exec
601
+ assert_equal "cd /src && bundle exec ruby -I test /src/test/file_1_test.rb --name='/test_name_2/'", shell_mock.recall_exec
543
602
  end
544
603
 
545
604
  def test__by_line_number__multiple_files
@@ -4,7 +4,7 @@ require "test_launcher/queries"
4
4
 
5
5
  module TestLauncher
6
6
  module Queries
7
- class MultiTermQueryTest < TestCase
7
+ class MultiPathQueryTest < TestCase
8
8
  include DefaultMocks
9
9
 
10
10
  def searcher
@@ -69,7 +69,7 @@ module TestLauncher
69
69
  runner: default_runner,
70
70
  searcher: searcher
71
71
  )
72
- command = MultiTermQuery.new(request, default_command_finder).command
72
+ command = MultiPathQuery.new(request, default_command_finder).command
73
73
 
74
74
  assert_equal nil, command
75
75
  end
@@ -81,7 +81,7 @@ module TestLauncher
81
81
  runner: default_runner,
82
82
  searcher: searcher
83
83
  )
84
- command = MultiTermQuery.new(request, default_command_finder).command
84
+ command = MultiPathQuery.new(request, default_command_finder).command
85
85
 
86
86
  assert_equal nil, command
87
87
  end
@@ -92,7 +92,7 @@ module TestLauncher
92
92
  shell: default_shell,
93
93
  searcher: searcher
94
94
  )
95
- command = MultiTermQuery.new(request, default_command_finder).command
95
+ command = MultiPathQuery.new(request, default_command_finder).command
96
96
 
97
97
  assert_equal 1, default_shell.recall(:warn).size
98
98
  end
@@ -104,7 +104,7 @@ module TestLauncher
104
104
  runner: default_runner,
105
105
  searcher: searcher,
106
106
  )
107
- command = MultiTermQuery.new(request, default_command_finder).command
107
+ command = MultiPathQuery.new(request, default_command_finder).command
108
108
 
109
109
  assert_equal [[[file_1_test_case, file_2_test_case]]], default_runner.recall(:multiple_files)
110
110
  assert_equal "multiple_files_return", command
@@ -117,7 +117,7 @@ module TestLauncher
117
117
  runner: default_runner,
118
118
  searcher: searcher,
119
119
  )
120
- command = MultiTermQuery.new(request, default_command_finder).command
120
+ command = MultiPathQuery.new(request, default_command_finder).command
121
121
  assert_equal [[[file_1_test_case, file_3_test_case, file_4_test_case]]], default_runner.recall(:multiple_files)
122
122
  assert_equal "multiple_files_return", command
123
123
  end
@@ -8,14 +8,14 @@ module TestLauncher
8
8
  include DefaultMocks
9
9
 
10
10
  def test__multi_search_term__hits
11
- command_finder = Mock.new(Queries::CommandFinder, multi_search_term: :multi_search_term)
11
+ command_finder = Mock.new(Queries::CommandFinder, multi_path_query: :multi_path_query)
12
12
  request = MockRequest.new(search_string: "a b")
13
13
 
14
- assert_equal :multi_search_term, SearchQuery.new(request, command_finder).command
14
+ assert_equal :multi_path_query, SearchQuery.new(request, command_finder).command
15
15
  end
16
16
 
17
17
  def test__multi_search_term__misses
18
- command_finder = Mock.new(Queries::CommandFinder, multi_search_term: nil, single_search_term: :single_search_term)
18
+ command_finder = Mock.new(Queries::CommandFinder, multi_path_query: nil, single_search_term: :single_search_term)
19
19
  request = MockRequest.new(search_string: "a b")
20
20
 
21
21
  assert_equal :single_search_term, SearchQuery.new(request, command_finder).command
@@ -83,10 +83,10 @@ module TestLauncher
83
83
  assert_equal "cd /src && bundle exec rspec /src/spec/class_2_spec.rb --example name_2", shell_mock.recall_exec
84
84
 
85
85
  launch("name_1 --all", searcher: searcher)
86
- assert_equal "cd /src && bundle exec rspec /src/spec/class_1_spec.rb /src/spec/class_2_spec.rb", shell_mock.recall_exec
86
+ assert_equal "cd /src && bundle exec rspec /src/spec/class_1_spec.rb /src/spec/class_2_spec.rb --example name_1", shell_mock.recall_exec
87
87
 
88
88
  launch("name_2 --all", searcher: searcher)
89
- assert_equal "cd /src && bundle exec rspec /src/spec/class_1_spec.rb /src/spec/class_2_spec.rb /src/spec/class_3_spec.rb", shell_mock.recall_exec
89
+ assert_equal "cd /src && bundle exec rspec /src/spec/class_1_spec.rb /src/spec/class_2_spec.rb /src/spec/class_3_spec.rb --example name_2", shell_mock.recall_exec
90
90
  end
91
91
 
92
92
  def test__by_filename
@@ -176,6 +176,66 @@ module TestLauncher
176
176
  assert_equal "cd /src && bundle exec rspec /src/spec/name_spec.rb", shell_mock.recall_exec
177
177
  end
178
178
 
179
+ def test__multiple_queries__generic_regex__prefers_to_keep_spaces
180
+ searcher = MemorySearcher.new do |searcher|
181
+ searcher.mock_file do |f|
182
+ f.path "/src/spec/file_1_spec.rb"
183
+ f.mtime Time.new(2013, 01, 01, 00, 00, 00)
184
+ f.contents <<-RB
185
+ this matches
186
+ RB
187
+ end
188
+
189
+ searcher.mock_file do |f|
190
+ f.path "/src/spec/file_2_spec.rb"
191
+ f.mtime Time.new(2015, 01, 01, 00, 00, 00)
192
+ f.contents <<-RB
193
+ this
194
+ matches
195
+ RB
196
+ end
197
+
198
+ launch("this matches", searcher: searcher)
199
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb", shell_mock.recall_exec
200
+
201
+ launch("this matches --all", searcher: searcher)
202
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb", shell_mock.recall_exec
203
+
204
+ launch("matches this --all", searcher: searcher)
205
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb", shell_mock.recall_exec
206
+ end
207
+ end
208
+
209
+ def test__multiple_queries__splits_spaces_for_test_names
210
+ searcher = MemorySearcher.new do |searcher|
211
+ searcher.mock_file do |f|
212
+ f.path "/src/spec/file_1_spec.rb"
213
+ f.mtime Time.new(2013, 01, 01, 00, 00, 00)
214
+ f.contents <<-RB
215
+ it "this" do
216
+ RB
217
+ end
218
+
219
+ searcher.mock_file do |f|
220
+ f.path "/src/spec/file_2_spec.rb"
221
+ f.mtime Time.new(2015, 01, 01, 00, 00, 00)
222
+ f.contents <<-RB
223
+ it "matches" do
224
+ RB
225
+ end
226
+
227
+ launch("this matches", searcher: searcher)
228
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb --example this\\|matches", shell_mock.recall_exec
229
+
230
+ skip "not supported in rspec yet"
231
+ launch("this matches --all", searcher: searcher)
232
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb --example this\\|matches", shell_mock.recall_exec
233
+
234
+ launch("matches this --all", searcher: searcher)
235
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb --example this\\|matches", shell_mock.recall_exec
236
+ end
237
+ end
238
+
179
239
  def test__by_multiple_filenames__multiple_files_found
180
240
  searcher = MemorySearcher.new do |searcher|
181
241
  searcher.mock_file do |f|
@@ -335,7 +395,7 @@ module TestLauncher
335
395
  assert_equal "cd /src && bundle exec rspec /src/spec/file_2_spec.rb --example test_name_\\\\d", shell_mock.recall_exec
336
396
 
337
397
  launch('test_name_\d --all', searcher: searcher)
338
- assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb", shell_mock.recall_exec
398
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb --example test_name_\\\\d", shell_mock.recall_exec
339
399
  end
340
400
 
341
401
  def test__not_found
@@ -384,7 +444,7 @@ module TestLauncher
384
444
  assert_equal "cd /src/inline/gem && bundle exec rspec /src/inline/gem/spec/file_1_spec.rb --example test_name_1", shell_mock.recall_exec
385
445
 
386
446
  launch("test_name_1 --all", searcher: searcher)
387
- assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb; cd -;\n\ncd /src/inline/gem && bundle exec rspec /src/inline/gem/spec/file_1_spec.rb", shell_mock.recall_exec
447
+ assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb --example test_name_1; cd -;\n\ncd /src/inline/gem && bundle exec rspec /src/inline/gem/spec/file_1_spec.rb --example test_name_1", shell_mock.recall_exec
388
448
 
389
449
  launch("file --all", searcher: searcher)
390
450
  assert_equal "cd /src && bundle exec rspec /src/spec/file_1_spec.rb /src/spec/file_2_spec.rb; cd -;\n\ncd /src/inline/gem && bundle exec rspec /src/inline/gem/spec/file_1_spec.rb", shell_mock.recall_exec
@@ -12,7 +12,7 @@ module TestLauncher
12
12
 
13
13
  def test_launch__run__example
14
14
  args = "/Users/username/some_app/bin/spring testunit /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
15
- expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name=some_test_name"
15
+ expected_command = "cd /Users/username/some_app/engines/some_engine && bundle exec ruby -I test /Users/username/some_app/engines/some_engine/test/does_something_test.rb --name='some_test_name'"
16
16
 
17
17
  assert_executes expected_command, args
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Kinnecom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,17 +82,6 @@ files:
82
82
  - test/test_helpers/mocks/searcher_mock.rb
83
83
  - test/test_launcher/cli/input_parser_test.rb
84
84
  - test/test_launcher/ex_unit_integration_test.rb
85
- - test/test_launcher/fixtures/minitest/Gemfile
86
- - test/test_launcher/fixtures/minitest/test/class_1_test.rb
87
- - test/test_launcher/fixtures/minitest/test/class_2_test.rb
88
- - test/test_launcher/fixtures/minitest/test/different_root/Gemfile
89
- - test/test_launcher/fixtures/minitest/test/different_root/bin/spring
90
- - test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb
91
- - test/test_launcher/fixtures/rspec/Gemfile
92
- - test/test_launcher/fixtures/rspec/spec/class_1_spec.rb
93
- - test/test_launcher/fixtures/rspec/spec/class_2_spec.rb
94
- - test/test_launcher/fixtures/rspec/spec/different_root/Gemfile
95
- - test/test_launcher/fixtures/rspec/spec/different_root/spec/different_root_spec.rb
96
85
  - test/test_launcher/frameworks/implementation/test_case_test.rb
97
86
  - test/test_launcher/frameworks/minitest/runner_test.rb
98
87
  - test/test_launcher/frameworks/minitest/searcher_test.rb
@@ -103,10 +92,9 @@ files:
103
92
  - test/test_launcher/queries/full_regex_query_test.rb
104
93
  - test/test_launcher/queries/generic_query_test.rb
105
94
  - test/test_launcher/queries/line_number_query_test.rb
106
- - test/test_launcher/queries/multi_term_query_test.rb
95
+ - test/test_launcher/queries/multi_path_query_test.rb
107
96
  - test/test_launcher/queries/path_query_test.rb
108
97
  - test/test_launcher/queries/search_query_test.rb
109
- - test/test_launcher/queries/single_term_query_test.rb
110
98
  - test/test_launcher/rspec_integration_test.rb
111
99
  - test/test_launcher/rubymine_test.rb
112
100
  - test/test_launcher/search/git_test.rb
@@ -145,17 +133,6 @@ test_files:
145
133
  - test/test_helpers/mocks/searcher_mock.rb
146
134
  - test/test_launcher/cli/input_parser_test.rb
147
135
  - test/test_launcher/ex_unit_integration_test.rb
148
- - test/test_launcher/fixtures/minitest/Gemfile
149
- - test/test_launcher/fixtures/minitest/test/class_1_test.rb
150
- - test/test_launcher/fixtures/minitest/test/class_2_test.rb
151
- - test/test_launcher/fixtures/minitest/test/different_root/Gemfile
152
- - test/test_launcher/fixtures/minitest/test/different_root/bin/spring
153
- - test/test_launcher/fixtures/minitest/test/different_root/test/different_root_test.rb
154
- - test/test_launcher/fixtures/rspec/Gemfile
155
- - test/test_launcher/fixtures/rspec/spec/class_1_spec.rb
156
- - test/test_launcher/fixtures/rspec/spec/class_2_spec.rb
157
- - test/test_launcher/fixtures/rspec/spec/different_root/Gemfile
158
- - test/test_launcher/fixtures/rspec/spec/different_root/spec/different_root_spec.rb
159
136
  - test/test_launcher/frameworks/implementation/test_case_test.rb
160
137
  - test/test_launcher/frameworks/minitest/runner_test.rb
161
138
  - test/test_launcher/frameworks/minitest/searcher_test.rb
@@ -166,10 +143,9 @@ test_files:
166
143
  - test/test_launcher/queries/full_regex_query_test.rb
167
144
  - test/test_launcher/queries/generic_query_test.rb
168
145
  - test/test_launcher/queries/line_number_query_test.rb
169
- - test/test_launcher/queries/multi_term_query_test.rb
146
+ - test/test_launcher/queries/multi_path_query_test.rb
170
147
  - test/test_launcher/queries/path_query_test.rb
171
148
  - test/test_launcher/queries/search_query_test.rb
172
- - test/test_launcher/queries/single_term_query_test.rb
173
149
  - test/test_launcher/rspec_integration_test.rb
174
150
  - test/test_launcher/rubymine_test.rb
175
151
  - test/test_launcher/search/git_test.rb
@@ -1,6 +0,0 @@
1
- require 'minitest/autorun'
2
- class Class1Test < Minitest::Test
3
- def test_1
4
- assert false, "1 was run"
5
- end
6
- end
@@ -1,9 +0,0 @@
1
- require 'minitest/autorun'
2
- class Class2Test < Minitest::Test
3
- def test_1
4
- assert false, "Class2: test_1 was run"
5
- end
6
- def test_2
7
- assert false, "Class2: test_2 was run"
8
- end
9
- end
@@ -1 +0,0 @@
1
- # stub to indicate that spring is active in this root
File without changes
@@ -1,16 +0,0 @@
1
- describe Root1DummyTestClass1 do
2
-
3
- context "file_name_1 context_1" do
4
- it "file_name_1 example_name_1 '\" " do
5
- test_unit_test_method_body
6
- end
7
-
8
- it 'file_name_1 example_name_2' do
9
- test_unit_test_method_body
10
- end
11
-
12
- it "multiple_files same_example" do
13
-
14
- end
15
- end
16
- end
@@ -1,6 +0,0 @@
1
- describe Root1DummyTestClass2 do
2
-
3
- it "multiple_files same_example" do
4
- a_test_that_uses(Root1DummyTestClass1)
5
- end
6
- end
@@ -1,2 +0,0 @@
1
- describe Root2DummyTestClass1 do
2
- end
@@ -1,36 +0,0 @@
1
- require "test_helper"
2
- require "test_helpers/mocks"
3
- require "test_launcher/queries"
4
-
5
- module TestLauncher
6
- module Queries
7
- class SingleTermQueryTest < TestCase
8
- include DefaultMocks
9
-
10
- def test__by_path
11
- command_finder = Mock.new(Queries::CommandFinder, by_path: :by_path)
12
-
13
- assert_equal :by_path, SingleTermQuery.new(MockRequest.new, command_finder).command
14
- end
15
-
16
- def test__example_name
17
- command_finder = Mock.new(Queries::CommandFinder, by_path: nil, example_name: :example_name)
18
-
19
- assert_equal :example_name, SingleTermQuery.new(MockRequest.new, command_finder).command
20
- end
21
-
22
- def test__from_full_regex
23
- command_finder = Mock.new(Queries::CommandFinder, by_path: nil, example_name: nil, from_full_regex: :from_full_regex)
24
-
25
- assert_equal :from_full_regex, SingleTermQuery.new(MockRequest.new, command_finder).command
26
- end
27
-
28
- def test__none
29
- command_finder = Mock.new(Queries::CommandFinder, by_path: nil, example_name: nil, from_full_regex: nil)
30
-
31
- assert_equal nil, SingleTermQuery.new(MockRequest.new, command_finder).command
32
- end
33
-
34
- end
35
- end
36
- end