test_launcher 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15db8103099d657fa88ed3321e03766dc28ccbc3
4
- data.tar.gz: 49f24e6a8e3a4f886c28fcfe3193b6314d5d167d
3
+ metadata.gz: 5eeb956c9e27d345208690928c5ca4e10093e55c
4
+ data.tar.gz: c4df62db1882ff9b84f5bef8e5fce0eeae710323
5
5
  SHA512:
6
- metadata.gz: 38c67f9eb592ab6d61a15cb2fa1710a847ce42632d4693835cb6e6c14de124c3c7b4e7da03f7c83755327d4139124d343f57d5d19a970b0afe4ce06612e5f819
7
- data.tar.gz: 9589081ac966e5ef5894b08ec948344275e95ea4a7febe7e411459d40f58c291f91d3026f0a702aaff503bfb757f8742366b3a435d9be5bf0109f6dd68db34e9
6
+ metadata.gz: 963183622cff5cfe3cb8cf190c6af93aa4321279800ff6a77e8b1cb1c7b5a41e309ac4e8f7cb4b7e152f69a18716d2a29c4c169a79e85939b05430c1dd927882
7
+ data.tar.gz: f291362f520ddbedd6f4e6113cbca76d1d1741c8ffcf7d48810e9c239fd77868c1d75393b98372b124e9dfb10b4341bbf21f576b68e2179a68e44df8a886017d
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new do |t|
5
+ t.libs = ["test"]
5
6
  t.test_files = Dir.glob("test/test_launcher/**/*_test.rb").reject {|f| f.match("fixtures")}
6
7
  end
7
8
 
@@ -32,7 +32,13 @@ module TestLauncher
32
32
  #
33
33
  file = files.first
34
34
  grep_results = raw_searcher.grep(example_name_regex, file_pattern: file)
35
- # return unless grep_results.any?
35
+
36
+ if grep_results.empty?
37
+ # the file exists, but doesn't appear to contain any tests...
38
+ # we'll try to run it anyway
39
+ return [file: file]
40
+ end
41
+
36
42
  best_result =
37
43
  grep_results
38
44
  .select {|r| line_number >= r[:line_number]}
@@ -38,7 +38,12 @@ module TestLauncher
38
38
 
39
39
  def find_files(pattern)
40
40
  relative_pattern = strip_system_path(pattern)
41
- interface.ls_files(relative_pattern).map {|f| system_path(f)}
41
+
42
+ if File.exist?(relative_pattern)
43
+ [system_path(relative_pattern)]
44
+ else
45
+ interface.ls_files(relative_pattern).map {|f| system_path(f)}
46
+ end
42
47
  end
43
48
 
44
49
  def grep(regex, file_pattern: '*')
@@ -1,3 +1,3 @@
1
1
  module TestLauncher
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
@@ -628,6 +628,22 @@ module TestLauncher
628
628
  assert shell_mock.recall(:warn).first.first.to_s.match(/Open an issue/)
629
629
  end
630
630
 
631
+ def test__by_line_number__file_contains_no_tests
632
+ searcher = MemorySearcher.new do |searcher|
633
+ searcher.mock_file do |f|
634
+ f.path "/src/test/file_test.rb"
635
+ f.mtime Time.new(2013, 01, 01, 00, 00, 00)
636
+ f.contents <<-RB
637
+ class File1Test
638
+ end
639
+ RB
640
+ end
641
+ end
642
+
643
+ launch("file_test.rb:1", searcher: searcher)
644
+ assert_equal "cd /src && bundle exec ruby -I test -e 'ARGV.each {|f| require(f)}' /src/test/file_test.rb", shell_mock.recall_exec
645
+ end
646
+
631
647
  def test__rerun
632
648
  searcher = MemorySearcher.new do |searcher|
633
649
  searcher.mock_file do |f|
@@ -23,6 +23,19 @@ module TestLauncher
23
23
 
24
24
  assert_equal ["/path/to/repo/inline_gem/relative/file_test.rb"], files
25
25
  end
26
+
27
+ def test_find_files__returns_file_if_exists
28
+ # git ls-files will not find newly created files
29
+ interface = mock {
30
+ expects(:root_path).returns("/path/to/repo")
31
+ }
32
+
33
+ File.stubs(:exist?).with('thing_test.rb').returns(true)
34
+ searcher = Git.new(nil, interface)
35
+ files = searcher.find_files("thing_test.rb")
36
+
37
+ assert_equal ['/path/to/repo/thing_test.rb'], files
38
+ end
26
39
  end
27
40
  end
28
41
  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.4.0
4
+ version: 2.5.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-05-22 00:00:00.000000000 Z
11
+ date: 2017-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler