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: e9a3973c1c93714b32d48281fc2d7ba0ca4079ec
4
- data.tar.gz: e098849973a735dbcc0838ca747718dd8362b645
3
+ metadata.gz: 4161a37a5915d6abe2d2055a10219a7d6a025ecc
4
+ data.tar.gz: c7e15dd7b38e1e2ed6bb80273338896fe8a576e3
5
5
  SHA512:
6
- metadata.gz: 0c59ea557a7bf56c7779e20b1c79e38a35d2d91d60209e9feaed7736715b2bd566da564d2872432d1bb54b907ebfa699e6f5dbe82cf9c150d7ed3dfb88857dd3
7
- data.tar.gz: b9d847ff5ac4f37097fab97a6e29cb1514548423ac1f49e7bacc21ac6607901e77018564a48e272cb552f42436e7d61ca791ab40710d37d4e4027d0bc0720e1b
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
- total_specs, failed_specs, pending_specs = 0, 0, 0
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
- total_specs += arr[0].to_i
8
- failed_specs += arr[1].to_i
9
- pending_specs += arr[3].to_i
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
- [total_specs, failed_specs, pending_specs]
12
+ summary
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module TestOutputParser
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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 == [1, 0, 0]
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 == [25, 0, 0]
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 == [30, 4, 0]
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 == [67, 0, 0]
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 == [1460, 1, 3]
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 == [1460, 1, 3]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-output-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akshay Karle