ci_reporter 1.6.5 → 1.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ == 1.6.6 (12/06/11)
2
+
3
+ - added code and spec to shorten filenames that will cause
4
+ Errno::ENAMETOOLONG
5
+ - RSpec 2.2.1 compatability
6
+
1
7
  == 1.6.5 (06/14/11)
2
8
 
3
9
  - Works with RSpec up to 2.6.x
@@ -1,16 +1,11 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- README.txt
3
+ README.rdoc
4
4
  LICENSE.txt
5
5
  Rakefile
6
6
  stub.rake
7
7
  lib/ci/reporter/core.rb
8
8
  lib/ci/reporter/cucumber.rb
9
- lib/ci/reporter/report_manager.rb
10
- lib/ci/reporter/rspec.rb
11
- lib/ci/reporter/test_suite.rb
12
- lib/ci/reporter/test_unit.rb
13
- lib/ci/reporter/version.rb
14
9
  lib/ci/reporter/rake/cucumber.rb
15
10
  lib/ci/reporter/rake/cucumber_loader.rb
16
11
  lib/ci/reporter/rake/rspec.rb
@@ -18,12 +13,17 @@ lib/ci/reporter/rake/rspec_loader.rb
18
13
  lib/ci/reporter/rake/test_unit.rb
19
14
  lib/ci/reporter/rake/test_unit_loader.rb
20
15
  lib/ci/reporter/rake/utils.rb
21
- spec/spec_helper.rb
16
+ lib/ci/reporter/report_manager.rb
17
+ lib/ci/reporter/rspec.rb
18
+ lib/ci/reporter/test_suite.rb
19
+ lib/ci/reporter/test_unit.rb
20
+ lib/ci/reporter/version.rb
22
21
  spec/ci/reporter/cucumber_spec.rb
23
22
  spec/ci/reporter/output_capture_spec.rb
23
+ spec/ci/reporter/rake/rake_tasks_spec.rb
24
24
  spec/ci/reporter/report_manager_spec.rb
25
25
  spec/ci/reporter/rspec_spec.rb
26
26
  spec/ci/reporter/test_suite_spec.rb
27
27
  spec/ci/reporter/test_unit_spec.rb
28
- spec/ci/reporter/rake/rake_tasks_spec.rb
28
+ spec/spec_helper.rb
29
29
  tasks/ci_reporter.rake
File without changes
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
- MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt", "Rakefile",
1
+ require 'bundler/setup'
2
+
3
+ MANIFEST = FileList["History.txt", "Manifest.txt", "README.rdoc", "LICENSE.txt", "Rakefile",
2
4
  "*.rake", "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
3
5
 
4
6
  begin
@@ -9,13 +11,15 @@ begin
9
11
  hoe = Hoe.spec("ci_reporter") do |p|
10
12
  p.version = CI::Reporter::VERSION
11
13
  p.rubyforge_name = "caldersphere"
14
+ p.readme_file = "README.rdoc"
12
15
  p.url = "http://caldersphere.rubyforge.org/ci_reporter"
13
16
  p.author = "Nick Sieger"
14
17
  p.email = "nick@nicksieger.com"
18
+ p.readme_file = 'README.rdoc'
15
19
  p.summary = "CI::Reporter allows you to generate reams of XML for use with continuous integration systems."
16
20
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
17
- p.description = p.paragraphs_of('README.txt', 0...1).join("\n\n")
18
- p.extra_deps.reject!{|d| d.first == "hoe"}
21
+ p.description = p.paragraphs_of('README.rdoc', 0...1).join("\n\n")
22
+ p.extra_rdoc_files += ["README.rdoc"]
19
23
  p.test_globs = ["spec/**/*_spec.rb"]
20
24
  p.extra_deps << ['builder', ">= 2.1.2"]
21
25
  end
@@ -84,11 +88,19 @@ task :rcov => "spec:rcov"
84
88
  task :generate_output do
85
89
  rm_rf "acceptance/reports"
86
90
  ENV['CI_REPORTS'] = "acceptance/reports"
91
+ if ENV['RUBYOPT']
92
+ opts = ENV['RUBYOPT']
93
+ ENV['RUBYOPT'] = nil
94
+ else
95
+ opts = "-rubygems"
96
+ end
87
97
  begin
88
- `ruby -Ilib -rubygems -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb` rescue puts "Warning: #{$!}"
89
- `ruby -Ilib -rubygems -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb` rescue puts "Warning: #{$!}"
90
- `ruby -Ilib -rubygems -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber` rescue puts "Warning: #{$!}"
98
+ result_proc = proc {|ok,*| puts "Failures above are expected." unless ok }
99
+ ruby "-Ilib #{opts} -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb", &result_proc
100
+ ruby "-Ilib #{opts} -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb", &result_proc
101
+ ruby "-Ilib #{opts} -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber", &result_proc
91
102
  ensure
103
+ ENV['RUBYOPT'] = opts if opts != "-rubygems"
92
104
  ENV.delete 'CI_REPORTS'
93
105
  end
94
106
  end
@@ -21,5 +21,11 @@ namespace :ci do
21
21
  "--format", "CI::Reporter::RSpecDoc"].join(" ")
22
22
  ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
23
23
  end
24
+
25
+ task :rspecbase => :spec_report_cleanup do
26
+ spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
27
+ "--format", "CI::Reporter::RSpecBase"].join(" ")
28
+ ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
29
+ end
24
30
  end
25
31
  end
@@ -33,12 +33,18 @@ module CI #:nodoc:
33
33
  # SPEC-MailsController.N.xml
34
34
  #
35
35
  # with N < 100000, to prevent endless sidestep loops
36
- MAX_SIDESTEPS = 100000
36
+ MAX_SIDESTEPS = 100000
37
+ MAX_FILENAME_SIZE = 240
37
38
  #
38
39
  def filename_for(suite)
39
40
  basename = "#{@basename}-#{suite.name.gsub(/[^a-zA-Z0-9]+/, '-')}"
40
41
  suffix = "xml"
41
42
 
43
+ # shorten basename if it exceeds 240 characters
44
+ # most filesystems have a 255 character limit
45
+ # so leave some room for the sidesteps
46
+ basename = basename[0..MAX_FILENAME_SIZE] if basename.length > MAX_FILENAME_SIZE
47
+
42
48
  # the initial filename, e.g. SPEC-MailsController.xml
43
49
  filename = [basename, suffix].join(".")
44
50
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -43,9 +43,9 @@ module CI
43
43
  !failure?
44
44
  end
45
45
 
46
- def name() exception.class.name end
47
- def message() exception.message end
48
- def location() (exception.backtrace || ["No backtrace available"]).join("\n") end
46
+ def name() @example.metadata[:execution_result][:exception].class.name end
47
+ def message() @example.metadata[:execution_result][:exception].message end
48
+ def location() @example.metadata[:execution_result][:exception].backtrace.join("\n") end
49
49
  end
50
50
 
51
51
  class RSpec2Failure < RSpecFailure
@@ -55,11 +55,19 @@ module CI
55
55
  @exception = @example.execution_result[:exception] || @example.execution_result[:exception_encountered]
56
56
  end
57
57
 
58
+ def name
59
+ @exception.class.name
60
+ end
61
+
62
+ def message
63
+ @exception.message
64
+ end
65
+
58
66
  def failure?
59
67
  exception.is_a?(::RSpec::Expectations::ExpectationNotMetError)
60
68
  end
61
69
 
62
- def location()
70
+ def location
63
71
  output = []
64
72
  output.push "#{exception.class.name << ":"}" unless exception.class.name =~ /RSpec/
65
73
  output.push @exception.message
@@ -164,6 +172,7 @@ module CI
164
172
  def dump_summary(*args)
165
173
  @formatter.dump_summary(*args)
166
174
  write_report
175
+ @formatter.dump_failures
167
176
  end
168
177
 
169
178
  def dump_pending
@@ -205,5 +214,12 @@ module CI
205
214
  super
206
215
  end
207
216
  end
217
+
218
+ class RSpecBase < RSpec
219
+ def initialize(*args)
220
+ @formatter = RSpecFormatters::BaseFormatter.new(*args)
221
+ super
222
+ end
223
+ end
208
224
  end
209
225
  end
@@ -1,5 +1,5 @@
1
1
  module CI
2
2
  module Reporter
3
- VERSION = "1.6.5"
3
+ VERSION = "1.6.6"
4
4
  end
5
5
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -18,14 +18,14 @@ describe "The ReportManager" do
18
18
  CI::Reporter::ReportManager.new("spec")
19
19
  File.directory?(@reports_dir).should be_true
20
20
  end
21
-
21
+
22
22
  it "should create the report directory based on CI_REPORTS environment variable if set" do
23
23
  @reports_dir = "#{Dir.getwd}/dummy"
24
24
  ENV["CI_REPORTS"] = @reports_dir
25
25
  CI::Reporter::ReportManager.new("spec")
26
26
  File.directory?(@reports_dir).should be_true
27
27
  end
28
-
28
+
29
29
  it "should write reports based on name and xml content of a test suite" do
30
30
  reporter = CI::Reporter::ReportManager.new("spec")
31
31
  suite = mock("test suite")
@@ -36,4 +36,15 @@ describe "The ReportManager" do
36
36
  File.exist?(filename).should be_true
37
37
  File.open(filename) {|f| f.read.should == "<xml></xml>"}
38
38
  end
39
+
40
+ it "should shorten extremely long report filenames" do
41
+ reporter = CI::Reporter::ReportManager.new("spec")
42
+ suite = mock("test suite")
43
+ suite.should_receive(:name).and_return("some test suite name that goes on and on and on and on and on and on and does not look like it will end any time soon and just when you think it is almost over it just continues to go on and on and on and on and on until it is almost over but wait there is more and then el fin")
44
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
45
+ reporter.write_report(suite)
46
+ filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name-that-goes-on-and-on-and-on-and-on-and-on-and-on-and-does-not-look-like-it-will-end-any-time-soon-and-just-when-you-think-it-is-almost-over-it-just-continues-t.xml"
47
+ File.exist?(filename).should be_true
48
+ File.open(filename) {|f| f.read.should == "<xml></xml>"}
49
+ end
39
50
  end
@@ -53,6 +53,7 @@ describe "The RSpec reporter" do
53
53
  @formatter.should_receive(:dump_failure).once
54
54
  @formatter.should_receive(:dump_summary).once
55
55
  @formatter.should_receive(:dump_pending).once
56
+ @formatter.should_receive(:dump_failures).once
56
57
  @formatter.should_receive(:close).once
57
58
 
58
59
  @fmt.start(3)
@@ -76,6 +77,7 @@ describe "The RSpec reporter" do
76
77
  @formatter.should_receive(:example_started).once
77
78
  @formatter.should_receive(:example_passed).once
78
79
  @formatter.should_receive(:dump_summary)
80
+ @formatter.should_receive(:dump_failures).once
79
81
  @report_mgr.should_receive(:write_report)
80
82
 
81
83
  @fmt.start(2)
@@ -96,6 +98,7 @@ describe "The RSpec reporter" do
96
98
  @formatter.should_receive(:example_started).with(example).once
97
99
  @formatter.should_receive(:example_passed).once
98
100
  @formatter.should_receive(:dump_summary)
101
+ @formatter.should_receive(:dump_failures).once
99
102
  @report_mgr.should_receive(:write_report).and_return do |suite|
100
103
  suite.testcases.last.name.should == "should do something"
101
104
  end
@@ -116,6 +119,7 @@ describe "The RSpec reporter" do
116
119
  @formatter.should_receive(:example_started).once
117
120
  @formatter.should_receive(:example_failed).once
118
121
  @formatter.should_receive(:dump_summary)
122
+ @formatter.should_receive(:dump_failures).once
119
123
  @report_mgr.should_receive(:write_report)
120
124
 
121
125
  @fmt.start(2)
metadata CHANGED
@@ -1,51 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_reporter
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 3
4
5
  prerelease:
5
- version: 1.6.5
6
+ segments:
7
+ - 1
8
+ - 6
9
+ - 6
10
+ version: 1.6.6
6
11
  platform: ruby
7
12
  authors:
8
- - Nick Sieger
13
+ - Nick Sieger
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-14 00:00:00 -05:00
14
- default_executable:
18
+ date: 2011-12-07 00:00:00 Z
15
19
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: builder
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 2.1.2
25
- type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rubyforge
29
- prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 2.0.4
36
- type: :development
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: hoe
40
- prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.9.4
47
- type: :development
48
- version_requirements: *id003
20
+ - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 15
28
+ segments:
29
+ - 2
30
+ - 1
31
+ - 2
32
+ version: 2.1.2
33
+ version_requirements: *id001
34
+ name: builder
35
+ prerelease: false
36
+ - !ruby/object:Gem::Dependency
37
+ type: :development
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 7
44
+ segments:
45
+ - 2
46
+ - 0
47
+ - 4
48
+ version: 2.0.4
49
+ version_requirements: *id002
50
+ name: rubyforge
51
+ prerelease: false
52
+ - !ruby/object:Gem::Dependency
53
+ type: :development
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 27
60
+ segments:
61
+ - 2
62
+ - 12
63
+ version: "2.12"
64
+ version_requirements: *id003
65
+ name: hoe
66
+ prerelease: false
67
+ - !ruby/object:Gem::Dependency
68
+ type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 19
75
+ segments:
76
+ - 3
77
+ - 10
78
+ version: "3.10"
79
+ version_requirements: *id004
80
+ name: rdoc
81
+ prerelease: false
49
82
  description: CI::Reporter is an add-on to Test::Unit, RSpec and Cucumber that allows you to generate XML reports of your test, spec and/or feature runs. The resulting files can be read by a continuous integration system that understands Ant's JUnit report XML format, thus allowing your CI system to track test/spec successes and failures.
50
83
  email: nick@nicksieger.com
51
84
  executables: []
@@ -53,77 +86,82 @@ executables: []
53
86
  extensions: []
54
87
 
55
88
  extra_rdoc_files:
56
- - History.txt
57
- - Manifest.txt
58
- - README.txt
59
- - LICENSE.txt
89
+ - History.txt
90
+ - Manifest.txt
91
+ - LICENSE.txt
92
+ - README.rdoc
60
93
  files:
61
- - History.txt
62
- - Manifest.txt
63
- - README.txt
64
- - LICENSE.txt
65
- - Rakefile
66
- - stub.rake
67
- - lib/ci/reporter/core.rb
68
- - lib/ci/reporter/cucumber.rb
69
- - lib/ci/reporter/report_manager.rb
70
- - lib/ci/reporter/rspec.rb
71
- - lib/ci/reporter/test_suite.rb
72
- - lib/ci/reporter/test_unit.rb
73
- - lib/ci/reporter/version.rb
74
- - lib/ci/reporter/rake/cucumber.rb
75
- - lib/ci/reporter/rake/cucumber_loader.rb
76
- - lib/ci/reporter/rake/rspec.rb
77
- - lib/ci/reporter/rake/rspec_loader.rb
78
- - lib/ci/reporter/rake/test_unit.rb
79
- - lib/ci/reporter/rake/test_unit_loader.rb
80
- - lib/ci/reporter/rake/utils.rb
81
- - spec/spec_helper.rb
82
- - spec/ci/reporter/cucumber_spec.rb
83
- - spec/ci/reporter/output_capture_spec.rb
84
- - spec/ci/reporter/report_manager_spec.rb
85
- - spec/ci/reporter/rspec_spec.rb
86
- - spec/ci/reporter/test_suite_spec.rb
87
- - spec/ci/reporter/test_unit_spec.rb
88
- - spec/ci/reporter/rake/rake_tasks_spec.rb
89
- - tasks/ci_reporter.rake
90
- has_rdoc: true
94
+ - History.txt
95
+ - Manifest.txt
96
+ - README.rdoc
97
+ - LICENSE.txt
98
+ - Rakefile
99
+ - stub.rake
100
+ - lib/ci/reporter/core.rb
101
+ - lib/ci/reporter/cucumber.rb
102
+ - lib/ci/reporter/rake/cucumber.rb
103
+ - lib/ci/reporter/rake/cucumber_loader.rb
104
+ - lib/ci/reporter/rake/rspec.rb
105
+ - lib/ci/reporter/rake/rspec_loader.rb
106
+ - lib/ci/reporter/rake/test_unit.rb
107
+ - lib/ci/reporter/rake/test_unit_loader.rb
108
+ - lib/ci/reporter/rake/utils.rb
109
+ - lib/ci/reporter/report_manager.rb
110
+ - lib/ci/reporter/rspec.rb
111
+ - lib/ci/reporter/test_suite.rb
112
+ - lib/ci/reporter/test_unit.rb
113
+ - lib/ci/reporter/version.rb
114
+ - spec/ci/reporter/cucumber_spec.rb
115
+ - spec/ci/reporter/output_capture_spec.rb
116
+ - spec/ci/reporter/rake/rake_tasks_spec.rb
117
+ - spec/ci/reporter/report_manager_spec.rb
118
+ - spec/ci/reporter/rspec_spec.rb
119
+ - spec/ci/reporter/test_suite_spec.rb
120
+ - spec/ci/reporter/test_unit_spec.rb
121
+ - spec/spec_helper.rb
122
+ - tasks/ci_reporter.rake
91
123
  homepage: http://caldersphere.rubyforge.org/ci_reporter
92
124
  licenses: []
93
125
 
94
126
  post_install_message:
95
127
  rdoc_options:
96
- - --main
97
- - README.txt
98
- - -SHN
99
- - -f
100
- - darkfish
128
+ - --main
129
+ - README.rdoc
130
+ - -SHN
131
+ - -f
132
+ - darkfish
101
133
  require_paths:
102
- - lib
134
+ - lib
103
135
  required_ruby_version: !ruby/object:Gem::Requirement
104
136
  none: false
105
137
  requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: "0"
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
143
+ version: "0"
109
144
  required_rubygems_version: !ruby/object:Gem::Requirement
110
145
  none: false
111
146
  requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: "0"
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ hash: 3
150
+ segments:
151
+ - 0
152
+ version: "0"
115
153
  requirements: []
116
154
 
117
155
  rubyforge_project: caldersphere
118
- rubygems_version: 1.5.1
156
+ rubygems_version: 1.8.6
119
157
  signing_key:
120
158
  specification_version: 3
121
159
  summary: CI::Reporter allows you to generate reams of XML for use with continuous integration systems.
122
160
  test_files:
123
- - spec/ci/reporter/cucumber_spec.rb
124
- - spec/ci/reporter/output_capture_spec.rb
125
- - spec/ci/reporter/report_manager_spec.rb
126
- - spec/ci/reporter/rspec_spec.rb
127
- - spec/ci/reporter/test_suite_spec.rb
128
- - spec/ci/reporter/test_unit_spec.rb
129
- - spec/ci/reporter/rake/rake_tasks_spec.rb
161
+ - spec/ci/reporter/cucumber_spec.rb
162
+ - spec/ci/reporter/output_capture_spec.rb
163
+ - spec/ci/reporter/rake/rake_tasks_spec.rb
164
+ - spec/ci/reporter/report_manager_spec.rb
165
+ - spec/ci/reporter/rspec_spec.rb
166
+ - spec/ci/reporter/test_suite_spec.rb
167
+ - spec/ci/reporter/test_unit_spec.rb