test-output-parser 0.0.2 → 0.0.3
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: 4161a37a5915d6abe2d2055a10219a7d6a025ecc
|
4
|
+
data.tar.gz: c7e15dd7b38e1e2ed6bb80273338896fe8a576e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa75d70842bb9b2d7e3ff8312f2475b79e8bac08a32cf222ee00186dd899201e0e77a11b6466767786349e0666fb7296e0b8496ff1831e15f5fda43211144dfa
|
7
|
+
data.tar.gz: aa06922d6642ca48724edcae46bae10126fce96189ab74a9b32fb0e466c7d2f8a82b5f36921d91c104a95ac84445ce69a2da6cbccf3c4f49df02a68e8b3815e3
|
@@ -2,14 +2,14 @@ module TestOutputParser
|
|
2
2
|
module Framework
|
3
3
|
class RSpec
|
4
4
|
def self.count(test_output)
|
5
|
-
|
5
|
+
summary = Hash.new(0)
|
6
6
|
test_output.scan(/(\d+)\s+example[s]?,\s+(\d+)\s+failure[s]?(,\s*(\d+)\s+pending)?/).each do |arr|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
summary[:total] += arr[0].to_i
|
8
|
+
summary[:failed] += arr[1].to_i
|
9
|
+
summary[:pending] += arr[3].to_i
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
summary
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,27 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe TestOutputParser do
|
4
|
+
it 'should do nothing when there is no spec summary in the output' do
|
5
|
+
TestOutputParser.count("123 foo bar examples").should == {}
|
6
|
+
end
|
7
|
+
|
4
8
|
it 'should count the number of specs ran for one example' do
|
5
|
-
TestOutputParser.count("1 example, 0 failures").should ==
|
9
|
+
TestOutputParser.count("1 example, 0 failures").should == {:total => 1, :failed => 0, :pending => 0}
|
6
10
|
end
|
7
11
|
|
8
12
|
it 'should count the number of specs ran for one rspec run' do
|
9
|
-
TestOutputParser.count("25 examples, 0 failures").should ==
|
13
|
+
TestOutputParser.count("25 examples, 0 failures").should == {:total => 25, :failed => 0, :pending => 0}
|
10
14
|
end
|
11
15
|
|
12
16
|
it 'should count the number of specs ran for multiple rspec runs' do
|
13
|
-
TestOutputParser.count("25 examples, 1 failure\n\n\n5 examples, 3 failures").should ==
|
17
|
+
TestOutputParser.count("25 examples, 1 failure\n\n\n5 examples, 3 failures").should == {:total => 30, :failed => 4, :pending => 0}
|
14
18
|
end
|
15
19
|
|
16
20
|
it 'should ignore lines not related to rspec test summary' do
|
17
|
-
TestOutputParser.count(File.read("spec/fixtures/sample-rspec-output.txt")).should ==
|
21
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-rspec-output.txt")).should == {:total => 67, :failed => 0, :pending => 0}
|
18
22
|
end
|
19
23
|
|
20
24
|
it 'should count failures correctly' do
|
21
|
-
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
|
25
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
|
22
26
|
end
|
23
27
|
|
24
28
|
it 'should count the number of pending specs' do
|
25
|
-
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should ==
|
29
|
+
TestOutputParser.count(File.read("spec/fixtures/sample-failed-rspec-output.txt")).should == {:total => 1460, :failed => 1, :pending => 3}
|
26
30
|
end
|
27
31
|
end
|