sfb_scripts 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa1bfa22f42bad325e3fae6d68a8cf56ae0ddadf
|
4
|
+
data.tar.gz: ef3751b60b61a8ccf310cb1f4bc6ccd08dd54361
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 623055c0dbf1357e7ca7c91ea2d1632d6456c5e842e89cc7d7691dcb0e2d98ce1b20902b28ef8b30d5af6a8d81fcbaba21ffd8fac848bc3b9f669d099ae54154
|
7
|
+
data.tar.gz: 12c2377cf70bbfab5505e18847994f2538cc747a5ed6b6836e86b462877e13693da6e515f70b4a0aace25487ffeecf92f4522f15ce2733b935e1a52956bfd5df
|
@@ -84,7 +84,8 @@ class TestCollection
|
|
84
84
|
private
|
85
85
|
|
86
86
|
def find_test_name(grepped_line)
|
87
|
-
return nil unless grepped_line
|
87
|
+
return nil unless grepped_line && grepped_line.match(/^\s*def\s+test_/)
|
88
|
+
|
88
89
|
grepped_line.strip.gsub(/^\s*def /, '').strip
|
89
90
|
end
|
90
91
|
|
@@ -92,7 +93,6 @@ class TestCollection
|
|
92
93
|
file_path = test_data[:file]
|
93
94
|
test_name = find_test_name(test_data[:line])
|
94
95
|
return nil if ! file_path.match(/_test\.rb/)
|
95
|
-
return nil if (test_name && ! test_name.match(/^test_/))
|
96
96
|
|
97
97
|
TestCase.new(
|
98
98
|
full_path: file_path,
|
@@ -21,11 +21,9 @@ class TestFileRunner
|
|
21
21
|
inputs.each {|input| files << repo.find_files(input).map {|f| {:file => f} } }
|
22
22
|
files.flatten!
|
23
23
|
@tests = TestCollection.new(files)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
shell.notify "Could not find matching test file."
|
28
|
-
end
|
24
|
+
|
25
|
+
return false unless @tests.present?
|
26
|
+
test_runner.run_files(tests)
|
29
27
|
end
|
30
28
|
|
31
29
|
def status
|
@@ -4,11 +4,16 @@ class TestMethodRunner
|
|
4
4
|
new(env).run(regex)
|
5
5
|
end
|
6
6
|
|
7
|
+
def self.run_file_with_match(regex, env)
|
8
|
+
new(env, pure_regex: true).run(regex)
|
9
|
+
end
|
10
|
+
|
7
11
|
attr_reader :regex, :repo, :shell, :test_runner
|
8
|
-
def initialize(env)
|
12
|
+
def initialize(env, pure_regex: false)
|
9
13
|
@repo = env[:repo]
|
10
14
|
@shell = env[:shell]
|
11
15
|
@test_runner = env[:test_runner]
|
16
|
+
@pure_regex = pure_regex
|
12
17
|
end
|
13
18
|
|
14
19
|
def run(regex)
|
@@ -18,7 +23,11 @@ class TestMethodRunner
|
|
18
23
|
shell.notify "Could not find matching test method."
|
19
24
|
return false
|
20
25
|
elsif tests.size == 1
|
21
|
-
|
26
|
+
if @pure_regex
|
27
|
+
test_runner.run_files(tests)
|
28
|
+
else
|
29
|
+
test_runner.run_method(tests.first)
|
30
|
+
end
|
22
31
|
elsif tests.in_one_file?
|
23
32
|
shell.notify "Multiple matches in same file. Running that file."
|
24
33
|
test_runner.run_files(tests)
|
@@ -38,7 +47,7 @@ class TestMethodRunner
|
|
38
47
|
end
|
39
48
|
|
40
49
|
def find_tests_by_name
|
41
|
-
test_def_regex = "^\s*def .*#{regex}.*"
|
50
|
+
test_def_regex = @pure_regex ? regex : "^\s*def .*#{regex}.*"
|
42
51
|
begin
|
43
52
|
return repo.grep(test_def_regex, file_pattern: '*_test.rb')
|
44
53
|
rescue ShellRunner::CommandFailureError
|
data/lib/sfb_scripts/tester.rb
CHANGED