starting_blocks 0.0.32 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,31 @@
|
|
1
1
|
module StartingBlocks
|
2
2
|
class ResultParser
|
3
3
|
def parse(text)
|
4
|
+
@text = text
|
4
5
|
{
|
5
|
-
tests:
|
6
|
-
assertions:
|
7
|
-
failures:
|
8
|
-
errors:
|
9
|
-
skips:
|
6
|
+
tests: greater_of([tests, runs]),
|
7
|
+
assertions: assertions,
|
8
|
+
failures: failures,
|
9
|
+
errors: errors,
|
10
|
+
skips: skips
|
10
11
|
}
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
private
|
15
|
+
|
16
|
+
def method_missing(meth, *args, &blk)
|
17
|
+
get_count_of meth.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_count_of name
|
21
|
+
@text.scan(/(\d+ #{name})/)[-1][0].split(' ')[0].to_i
|
15
22
|
rescue
|
16
23
|
0
|
17
24
|
end
|
25
|
+
|
26
|
+
def greater_of values
|
27
|
+
values.sort_by { |x| x }.last
|
28
|
+
end
|
18
29
|
end
|
19
30
|
end
|
20
31
|
|
@@ -83,4 +83,33 @@ EOF
|
|
83
83
|
subject.parse(text).contrast_with! expected_results
|
84
84
|
end
|
85
85
|
end
|
86
|
+
|
87
|
+
describe "simple case, minitest 5.0" do
|
88
|
+
let(:text) do <<EOF
|
89
|
+
Fabulous run in 0.000372s, 2688.1720 runs/s, 2688.1720 assertions/s.
|
90
|
+
|
91
|
+
2 runs, 3 assertions, 4 failures, 5 errors, 6 skips
|
92
|
+
|
93
|
+
asldkjflaskjflsakj
|
94
|
+
EOF
|
95
|
+
end
|
96
|
+
|
97
|
+
let(:expected_results) do
|
98
|
+
{
|
99
|
+
tests: 2,
|
100
|
+
assertions: 3,
|
101
|
+
failures: 4,
|
102
|
+
errors: 5,
|
103
|
+
skips: 6
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
def subject
|
108
|
+
StartingBlocks::ResultParser.new
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should return the counts" do
|
112
|
+
subject.parse(text).contrast_with! expected_results
|
113
|
+
end
|
114
|
+
end
|
86
115
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: starting_blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
177
|
version: '0'
|
178
178
|
segments:
|
179
179
|
- 0
|
180
|
-
hash: -
|
180
|
+
hash: -1635495602308467286
|
181
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
segments:
|
188
188
|
- 0
|
189
|
-
hash: -
|
189
|
+
hash: -1635495602308467286
|
190
190
|
requirements: []
|
191
191
|
rubyforge_project:
|
192
192
|
rubygems_version: 1.8.24
|