rspec-extra-formatters 0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rst CHANGED
@@ -4,41 +4,46 @@ RSpec Formatters
4
4
 
5
5
  ::
6
6
 
7
- $ rake format=tap
8
- ok 1 - TapFormatter should initialize the counter to 0
9
- ok 2 - TapFormatter example_passed should increment the counter and use the full_description attribute
10
- ok 3 - TapFormatter example_failed should increment the counter and use the full_description attribute
11
- ok 4 - TapFormatter example_pending should do the same as example_failed with TODO comment
12
- ok 5 - TapFormatter dump_summary should print the number of tests if there were tests
13
- ok 6 - TapFormatter dump_summary should print nothing if there were not tests
14
- ok 7 - JUnitFormatter should initialize the tests with failures and success
15
- ok 8 - JUnitFormatter example_passed should push the example obj into success list
16
- ok 9 - JUnitFormatter example_failed should push the example obj into failures list
17
- ok 10 - JUnitFormatter example_pending should do the same as example_failed
18
- ok 11 - JUnitFormatter read_failure should ignore if there is no exception
19
- ok 12 - JUnitFormatter read_failure should read message and backtrace from the example
20
- ok 13 - JUnitFormatter dump_summary should print the junit xml
21
- 1..13
7
+ $ rake format=tap | sed 1d
8
+ TAP version 13
9
+ 1..15
10
+ ok 1 - JUnitFormatter should initialize the tests with failures and success
11
+ ok 2 - JUnitFormatter example_passed should push the example obj into success list
12
+ ok 3 - JUnitFormatter example_failed should push the example obj into failures list
13
+ ok 4 - JUnitFormatter example_pending should push the example obj into the skipped list
14
+ ok 5 - JUnitFormatter read_failure should ignore if there is no exception
15
+ ok 6 - JUnitFormatter read_failure should attempt to read exception if exception encountered is nil
16
+ ok 7 - JUnitFormatter read_failure should read message and backtrace from the example
17
+ ok 8 - JUnitFormatter dump_summary should print the junit xml
18
+ ok 9 - JUnitFormatter dump_summary should escape characteres <,>,&," before building xml
19
+ ok 10 - TapFormatter should initialize the counter to 0
20
+ ok 11 - TapFormatter example_passed should increment the counter and use the full_description attribute
21
+ ok 12 - TapFormatter example_failed should increment the counter and use the full_description attribute
22
+ ok 13 - TapFormatter example_pending should do the same as example_failed with SKIP comment
23
+ ok 14 - TapFormatter dump_summary should print the number of tests if there were tests
24
+ ok 15 - TapFormatter dump_summary should print nothing if there were not tests
22
25
 
23
26
  ::
24
27
 
25
- $ rake format=junit
26
- <?xml version="1.0" encoding="utf-8" ?>
27
- <testsuite errors="0" failures="0" tests="13" time="0.019992" timestamp="2011-01-21T23:07:41-02:00">
28
- <properties />
29
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter should initialize the counter to 0" time="0.001298" />
30
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter example_passed should increment the counter and use the full_description attribute" time="0.001546" />
31
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter example_failed should increment the counter and use the full_description attribute" time="0.001427" />
32
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter example_pending should do the same as example_failed" time="0.001456" />
33
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter dump_summary should print the number of tests if there were tests" time="0.00177" />
34
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/tap_formatter_spec.rb" name="TapFormatter dump_summary should print nothing if there were not tests" time="0.000398" />
35
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter should initialize the tests with failures and success" time="0.000859" />
36
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter example_passed should push the example obj into success list" time="0.000829" />
37
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter example_failed should push the example obj into failures list" time="0.000778" />
38
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter example_pending should do the same as example_failed" time="0.000758" />
39
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter read_failure should ignore if there is no exception" time="0.00119" />
40
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter read_failure should read message and backtrace from the example" time="0.001823" />
41
- <testcase classname="/home/dsouza/dev/github/rspec_formatters/spec/junit_formatter_spec.rb" name="JUnitFormatter dump_summary should print the junit xml" time="0.003813" />
28
+ $ rake format=junit | sed 1d
29
+ <?xml version="1.0" encoding="utf-8"?>
30
+ <testsuite errors="0" failures="0" skipped="0" tests="15" time="0.008132403" timestamp="2012-12-03T17:52:59-02:00">
31
+ <properties/>
32
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter should initialize the tests with failures and success" time="0.00258258"/>
33
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter example_passed should push the example obj into success list" time="0.000210973"/>
34
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter example_failed should push the example obj into failures list" time="0.00019527"/>
35
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter example_pending should push the example obj into the skipped list" time="0.000194194"/>
36
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter read_failure should ignore if there is no exception" time="0.000330483"/>
37
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter read_failure should attempt to read exception if exception encountered is nil" time="0.000629093"/>
38
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter read_failure should read message and backtrace from the example" time="0.00054028"/>
39
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter dump_summary should print the junit xml" time="0.000990184"/>
40
+ <testcase classname="./spec/rspec-extra-formatters/junit_formatter_spec.rb" name="JUnitFormatter dump_summary should escape characteres &lt;,&gt;,&amp;,&quot; before building xml" time="0.00040997"/>
41
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter should initialize the counter to 0" time="7.3649e-05"/>
42
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter example_passed should increment the counter and use the full_description attribute" time="0.000205454"/>
43
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter example_failed should increment the counter and use the full_description attribute" time="0.00029728"/>
44
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter example_pending should do the same as example_failed with SKIP comment" time="0.000325112"/>
45
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter dump_summary should print the number of tests if there were tests" time="0.000372799"/>
46
+ <testcase classname="./spec/rspec-extra-formatters/tap_formatter_spec.rb" name="TapFormatter dump_summary should print nothing if there were not tests" time="6.3588e-05"/>
42
47
  </testsuite>
43
48
 
44
49
  Using it
@@ -31,16 +31,24 @@ require "rspec/core/formatters/base_formatter"
31
31
  class TapFormatter < RSpec::Core::Formatters::BaseFormatter
32
32
 
33
33
  attr_reader :total
34
-
34
+ $VERBOSE = nil
35
35
  OK = 'ok'
36
36
  NOT_OK = 'not ok'
37
37
  TODO = '# TODO '
38
+ SKIP = '# SKIP '
38
39
 
39
40
  def initialize(output)
40
41
  super(output)
41
42
  @total = 0
42
43
  end
43
44
 
45
+ def start(example_count)
46
+ super(example_count)
47
+ output.puts("TAP version 13")
48
+ output.puts("1.." + example_count.to_s)
49
+
50
+ end
51
+
44
52
  def example_passed(example)
45
53
  super(example)
46
54
  tap_example_output(OK, example)
@@ -48,19 +56,21 @@ class TapFormatter < RSpec::Core::Formatters::BaseFormatter
48
56
 
49
57
  def example_pending(example)
50
58
  super(example)
51
- tap_example_output(NOT_OK, example, TODO)
59
+ tap_example_output(NOT_OK, example, SKIP)
52
60
  end
53
61
 
54
62
  def example_failed(example)
55
63
  super(example)
56
64
  tap_example_output(NOT_OK, example)
65
+ output.puts(" ---")
66
+ my_exception = example.exception.to_s
67
+ my_exception.gsub! /"/, ''
68
+ output.puts(" #{my_exception} ")
69
+ output.puts(" ...")
57
70
  end
58
71
 
59
72
  def dump_summary(duration, example_count, failure_count, pending_count)
60
73
  super(duration, example_count, failure_count, pending_count)
61
- if (@total > 0)
62
- output.puts("1..#{example_count}")
63
- end
64
74
  end
65
75
 
66
76
  private
@@ -55,6 +55,7 @@ describe TapFormatter do
55
55
 
56
56
  it "should increment the counter and use the full_description attribute" do
57
57
  example = mock("example")
58
+ example.stub(:exception) { "exception message" }
58
59
  example.should_receive(:metadata).and_return({:full_description => "foobar"})
59
60
 
60
61
  output = StringIO.new
@@ -62,14 +63,20 @@ describe TapFormatter do
62
63
  f.example_failed(example)
63
64
 
64
65
  f.total.should eql(1)
65
- output.string.should == "not ok 1 - foobar\n"
66
+ output.string.should == <<-EOF
67
+ not ok 1 - foobar
68
+ ---
69
+ exception message
70
+ ...
71
+ EOF
66
72
  end
67
73
  end
68
74
 
69
75
  describe "example_pending" do
70
76
 
71
- it "should do the same as example_failed with TODO comment" do
77
+ it "should do the same as example_failed with SKIP comment" do
72
78
  example = mock("example")
79
+ example.stub(:exception) { "exception message" }
73
80
  example.should_receive(:metadata).and_return({:full_description => "foobar"})
74
81
 
75
82
  output = StringIO.new
@@ -77,7 +84,7 @@ describe TapFormatter do
77
84
  f.example_pending(example)
78
85
 
79
86
  f.total.should eql(1)
80
- output.string.should == "not ok 1 - # TODO foobar\n"
87
+ output.string.should == "not ok 1 - # SKIP foobar\n"
81
88
  end
82
89
 
83
90
  end
@@ -86,6 +93,7 @@ describe TapFormatter do
86
93
 
87
94
  it "should print the number of tests if there were tests" do
88
95
  example = mock("example")
96
+ example.stub(:exception) { "exception message" }
89
97
  example.should_receive(:metadata).and_return({:full_description => "foobar"})
90
98
  example.should_receive(:metadata).and_return({:full_description => "foobar"})
91
99
  example.should_receive(:metadata).and_return({:full_description => "foobar"})
@@ -100,8 +108,10 @@ describe TapFormatter do
100
108
  output.string.should == <<-EOF
101
109
  ok 1 - foobar
102
110
  not ok 2 - foobar
103
- not ok 3 - # TODO foobar
104
- 1..3
111
+ ---
112
+ exception message
113
+ ...
114
+ not ok 3 - # SKIP foobar
105
115
  EOF
106
116
  end
107
117
 
metadata CHANGED
@@ -1,90 +1,78 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rspec-extra-formatters
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- version: "0.4"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Diego Souza
13
- - "Flor\xC3\xA9al TOUMIKIAN"
9
+ - Floréal TOUMIKIAN
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2012-04-24 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
13
+ date: 2012-04-24 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
21
16
  name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
24
18
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
32
23
  type: :development
33
- version_requirements: *id001
34
- description: " rspec-extra-formatters Provides TAP and JUnit formatters for rspec\n"
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: ! ' rspec-extra-formatters Provides TAP and JUnit formatters for rspec
32
+
33
+ '
35
34
  email: dsouza+rspec-extra-formatters@bitforest.org
36
35
  executables: []
37
-
38
36
  extensions: []
39
-
40
- extra_rdoc_files:
37
+ extra_rdoc_files:
41
38
  - LICENSE
42
39
  - README.rst
43
- files:
40
+ files:
44
41
  - lib/tap_formatter.rb
45
- - lib/rspec-extra-formatters.rb
46
42
  - lib/rspec-extra-formatters/tap_formatter.rb
47
43
  - lib/rspec-extra-formatters/junit_formatter.rb
48
44
  - lib/j_unit_formatter.rb
45
+ - lib/rspec-extra-formatters.rb
49
46
  - LICENSE
50
47
  - README.rst
51
- - spec/rspec-extra-formatters/tap_formatter_spec.rb
52
48
  - spec/rspec-extra-formatters/junit_formatter_spec.rb
49
+ - spec/rspec-extra-formatters/tap_formatter_spec.rb
53
50
  - spec/spec_helper.rb
54
- homepage: http://dsouza.bitforest.org/2011/01/22/rspec-tap-and-junit-formatters/
51
+ homepage: https://github.com/dgvncsz0f/rspec_formatters
55
52
  licenses: []
56
-
57
53
  post_install_message:
58
54
  rdoc_options: []
59
-
60
- require_paths:
55
+ require_paths:
61
56
  - lib
62
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
63
58
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
64
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
80
69
  requirements: []
81
-
82
70
  rubyforge_project:
83
- rubygems_version: 1.8.6
71
+ rubygems_version: 1.8.24
84
72
  signing_key:
85
73
  specification_version: 3
86
74
  summary: TAP and JUnit formatters for rspec
87
- test_files:
88
- - spec/rspec-extra-formatters/tap_formatter_spec.rb
75
+ test_files:
89
76
  - spec/rspec-extra-formatters/junit_formatter_spec.rb
77
+ - spec/rspec-extra-formatters/tap_formatter_spec.rb
90
78
  - spec/spec_helper.rb