ci_reporter 1.6.9 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person
4
4
  # obtaining a copy of this software and associated documentation files
@@ -1,29 +1,32 @@
1
1
  History.txt
2
+ LICENSE.txt
2
3
  Manifest.txt
3
4
  README.rdoc
4
- LICENSE.txt
5
5
  Rakefile
6
- stub.rake
7
6
  lib/ci/reporter/core.rb
8
7
  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
8
+ lib/ci/reporter/minitest.rb
14
9
  lib/ci/reporter/rake/cucumber.rb
15
10
  lib/ci/reporter/rake/cucumber_loader.rb
11
+ lib/ci/reporter/rake/minitest.rb
12
+ lib/ci/reporter/rake/minitest_loader.rb
16
13
  lib/ci/reporter/rake/rspec.rb
17
14
  lib/ci/reporter/rake/rspec_loader.rb
18
15
  lib/ci/reporter/rake/test_unit.rb
19
16
  lib/ci/reporter/rake/test_unit_loader.rb
20
17
  lib/ci/reporter/rake/utils.rb
21
- spec/spec_helper.rb
18
+ lib/ci/reporter/report_manager.rb
19
+ lib/ci/reporter/rspec.rb
20
+ lib/ci/reporter/test_suite.rb
21
+ lib/ci/reporter/test_unit.rb
22
+ lib/ci/reporter/version.rb
22
23
  spec/ci/reporter/cucumber_spec.rb
23
24
  spec/ci/reporter/output_capture_spec.rb
25
+ spec/ci/reporter/rake/rake_tasks_spec.rb
24
26
  spec/ci/reporter/report_manager_spec.rb
25
27
  spec/ci/reporter/rspec_spec.rb
26
28
  spec/ci/reporter/test_suite_spec.rb
27
29
  spec/ci/reporter/test_unit_spec.rb
28
- spec/ci/reporter/rake/rake_tasks_spec.rb
30
+ spec/spec_helper.rb
31
+ stub.rake
29
32
  tasks/ci_reporter.rake
@@ -16,6 +16,7 @@ CI::Reporter works best with projects that use a +Rakefile+ along with the stand
16
16
  require 'ci/reporter/rake/rspec' # use this if you're using RSpec
17
17
  require 'ci/reporter/rake/cucumber' # use this if you're using Cucumber
18
18
  require 'ci/reporter/rake/test_unit' # use this if you're using Test::Unit
19
+ require 'ci/reporter/rake/minitest' # use this if you're using MiniTest::Unit
19
20
 
20
21
  2. Next, either modify your Rakefile to make the <code>ci:setup:rspec</code>, <code>ci:setup:cucumber</code> or <code>ci:setup:testunit</code> task a dependency of your test tasks, or include them on the Rake command-line before the name of the task that runs the tests or specs.
21
22
 
@@ -28,6 +29,7 @@ Report files are written, by default, to the <code>test/reports</code>, <code>fe
28
29
  If you don't have control over the Rakefile or don't want to modify it, CI::Reporter has a substitute rake file that you can specify on the command-line. It assumes that the main project rake file is called +Rakefile+ and lives in the current directory. Run like so:
29
30
 
30
31
  rake -f GEM_PATH/stub.rake ci:setup:testunit test
32
+ rake -f GEM_PATH/stub.rake ci:setup:minitest test
31
33
  rake -f GEM_PATH/stub.rake ci:setup:rspec spec
32
34
  rake -f GEM_PATH/stub.rake ci:setup:cucumber features
33
35
 
data/Rakefile CHANGED
@@ -1,10 +1,16 @@
1
+ #--
2
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
3
+ # See the file LICENSE.txt included with the distribution for
4
+ # software license details.
5
+ #++
6
+
1
7
  require 'bundler/setup'
2
8
 
3
9
  MANIFEST = FileList["History.txt", "Manifest.txt", "README.rdoc", "LICENSE.txt", "Rakefile",
4
10
  "*.rake", "lib/**/*.rb", "spec/**/*.rb", "tasks/**/*.rake"]
5
11
 
6
12
  begin
7
- File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
13
+ File.open("Manifest.txt", "w") {|f| MANIFEST.sort.each {|n| f << "#{n}\n"} }
8
14
  require 'hoe'
9
15
  Hoe.plugin :rubyforge
10
16
  require File.dirname(__FILE__) + '/lib/ci/reporter/version'
@@ -43,8 +49,8 @@ end
43
49
  Rake::Task[task].actions.clear
44
50
  end
45
51
 
46
- # No RCov on JRuby at the moment
47
- if RUBY_PLATFORM =~ /java/
52
+ # RCov only on 1.8
53
+ if defined?(RUBY_ENGINE)
48
54
  task :default => :spec
49
55
  else
50
56
  task :default => :rcov
@@ -61,6 +67,7 @@ rescue LoadError
61
67
  end
62
68
 
63
69
  RSpecTask.new do |t|
70
+ t.rspec_opts = "--color"
64
71
  end
65
72
 
66
73
  RSpecTask.new("spec:rcov") do |t|
@@ -80,9 +87,6 @@ begin
80
87
  rescue LoadError
81
88
  end
82
89
 
83
- task "spec:rcov" do
84
- rm_f "Manifest.txt"
85
- end
86
90
  task :rcov => "spec:rcov"
87
91
 
88
92
  task :generate_output do
@@ -97,6 +101,7 @@ task :generate_output do
97
101
  begin
98
102
  result_proc = proc {|ok,*| puts "Failures above are expected." unless ok }
99
103
  ruby "-Ilib #{opts} -rci/reporter/rake/test_unit_loader acceptance/test_unit_example_test.rb", &result_proc
104
+ ruby "-Ilib #{opts} -rci/reporter/rake/minitest_loader acceptance/minitest_example_test.rb", &result_proc
100
105
  ruby "-Ilib #{opts} -S #{@spec_bin} --require ci/reporter/rake/rspec_loader --format CI::Reporter::RSpec acceptance/rspec_example_spec.rb", &result_proc
101
106
  ruby "-Ilib #{opts} -rci/reporter/rake/cucumber_loader -S cucumber --format CI::Reporter::Cucumber acceptance/cucumber", &result_proc
102
107
  ensure
@@ -108,6 +113,7 @@ task :acceptance => :generate_output
108
113
 
109
114
  RSpecTask.new(:acceptance_spec) do |t|
110
115
  t.pattern = FileList['acceptance/verification_spec.rb']
116
+ t.rspec_opts = "--color"
111
117
  end
112
118
  task :acceptance => :acceptance_spec
113
119
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -0,0 +1,220 @@
1
+ # Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require 'ci/reporter/core'
6
+
7
+ require 'minitest/unit'
8
+
9
+ module CI
10
+ module Reporter
11
+ class Failure
12
+ def self.new(fault, type = nil, meth = nil)
13
+ return MiniTestSkipped.new(fault) if type == :skip
14
+ return MiniTestFailure.new(fault, meth) if type == :failure
15
+ MiniTestError.new(fault)
16
+ end
17
+ end
18
+
19
+ class FailureCore
20
+ def location(e)
21
+ last_before_assertion = ""
22
+ e.backtrace.reverse_each do |s|
23
+ break if s =~ /in .(assert|refute|flunk|pass|fail|raise|must|wont)/
24
+ last_before_assertion = s
25
+ end
26
+ last_before_assertion.sub(/:in .*$/, '')
27
+ end
28
+ end
29
+
30
+ class MiniTestSkipped < FailureCore
31
+ def initialize(fault) @fault = fault end
32
+ def failure?() false end
33
+ def error?() false end
34
+ def name() @fault.class.name end
35
+ def message() @fault.message end
36
+ def location() super @fault end
37
+ end
38
+
39
+ class MiniTestFailure < FailureCore
40
+ def initialize(fault, meth) @fault = fault; @meth = meth end
41
+ def failure?() true end
42
+ def error?() false end
43
+ def name() @meth end
44
+ def message() @fault.message end
45
+ def location() super @fault end
46
+ end
47
+
48
+ class MiniTestError < FailureCore
49
+ def initialize(fault) @fault = fault end
50
+ def failure?() false end
51
+ def error?() true end
52
+ def name() @fault.exception.class.name end
53
+ def message() @fault.exception.message end
54
+ def location() @fault.exception.backtrace.join("\n") end
55
+ end
56
+
57
+ class Runner < MiniTest::Unit
58
+
59
+ @@out = $stdout
60
+
61
+ def initialize
62
+ super
63
+ @report_manager = ReportManager.new("test")
64
+ end
65
+
66
+ def _run_anything(type)
67
+ suites = MiniTest::Unit::TestCase.send "#{type}_suites"
68
+ return if suites.empty?
69
+
70
+ started_anything type
71
+
72
+ sync = output.respond_to? :"sync=" # stupid emacs
73
+ old_sync, output.sync = output.sync, true if sync
74
+
75
+ _run_suites(suites, type)
76
+
77
+ output.sync = old_sync if sync
78
+
79
+ finished_anything(type)
80
+ end
81
+
82
+ def _run_suites(suites, type)
83
+ suites.map { |suite| _run_suite suite, type }
84
+ end
85
+
86
+ def _run_suite(suite, type)
87
+ start_suite(suite)
88
+
89
+ header = "#{type}_suite_header"
90
+ puts send(header, suite) if respond_to? header
91
+
92
+ filter_suite_methods(suite, type).each do |method|
93
+ _run_test(suite, method)
94
+ end
95
+
96
+ finish_suite
97
+ end
98
+
99
+ def _run_test(suite, method)
100
+ start_case(method)
101
+
102
+ result = run_test(suite, method)
103
+
104
+ @assertion_count += result._assertions
105
+ @test_count += 1
106
+
107
+ finish_case
108
+ end
109
+
110
+ def puke(klass, meth, e)
111
+ e = case e
112
+ when MiniTest::Skip then
113
+ @skips += 1
114
+ fault(e, :skip)
115
+ return "S" unless @verbose
116
+ "Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
117
+ when MiniTest::Assertion then
118
+ @failures += 1
119
+ fault(e, :failure, meth)
120
+ "Failure:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
121
+ else
122
+ @errors += 1
123
+ fault(e, :error)
124
+ bt = MiniTest::filter_backtrace(e.backtrace).join "\n "
125
+ "Error:\n#{meth}(#{klass}):\n#{e.class}: #{e.message}\n #{bt}\n"
126
+ end
127
+ @report << e
128
+ e[0, 1]
129
+ end
130
+
131
+ private
132
+
133
+ def started_anything(type)
134
+ @test_count = 0
135
+ @assertion_count = 0
136
+ @last_assertion_count = 0
137
+ @result_assertion_count = 0
138
+ @start = Time.now
139
+
140
+ puts
141
+ puts "# Running #{type}s:"
142
+ puts
143
+ end
144
+
145
+ def finished_anything(type)
146
+ t = Time.now - @start
147
+ puts
148
+ puts
149
+ puts "Finished #{type}s in %.6fs, %.4f tests/s, %.4f assertions/s." %
150
+ [t, @test_count / t, @assertion_count / t]
151
+
152
+ report.each_with_index do |msg, i|
153
+ puts "\n%3d) %s" % [i + 1, msg]
154
+ end
155
+
156
+ puts
157
+
158
+ status
159
+ end
160
+
161
+ def filter_suite_methods(suite, type)
162
+ filter = options[:filter] || '/./'
163
+ filter = Regexp.new $1 if filter =~ /\/(.*)\//
164
+
165
+ suite.send("#{type}_methods").grep(filter)
166
+ end
167
+
168
+ def run_test(suite, method)
169
+ inst = suite.new method
170
+ inst._assertions = 0
171
+
172
+ print "#{suite}##{method} = " if @verbose
173
+
174
+ @start_time = Time.now
175
+ result = inst.run self
176
+ time = Time.now - @start_time
177
+
178
+ print "%.2f s = " % time if @verbose
179
+ print result
180
+ puts if @verbose
181
+
182
+ return inst
183
+ end
184
+
185
+ def start_suite(suite_name)
186
+ @current_suite = CI::Reporter::TestSuite.new(suite_name)
187
+ @current_suite.start
188
+ end
189
+
190
+ def finish_suite
191
+ if @current_suite
192
+ @current_suite.finish
193
+ @current_suite.assertions = @assertion_count - @last_assertion_count
194
+ @last_assertion_count = @assertion_count
195
+ @report_manager.write_report(@current_suite)
196
+ end
197
+ end
198
+
199
+ def start_case(test_name)
200
+ tc = CI::Reporter::TestCase.new(test_name)
201
+ tc.start
202
+ @current_suite.testcases << tc
203
+ end
204
+
205
+ def finish_case
206
+ tc = @current_suite.testcases.last
207
+ tc.finish
208
+ tc.assertions = @assertion_count - @result_assertion_count
209
+ @result_assertion_count = @assertion_count
210
+ end
211
+
212
+ def fault(fault, type = nil, meth = nil)
213
+ tc = @current_suite.testcases.last
214
+ tc.failures << Failure.new(fault, type, meth)
215
+ end
216
+
217
+ end
218
+
219
+ end
220
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -0,0 +1,15 @@
1
+ # Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ require File.expand_path('../utils', __FILE__)
6
+
7
+ namespace :ci do
8
+ namespace :setup do
9
+ task :minitest do
10
+ rm_rf ENV["CI_REPORTS"] || "test/reports"
11
+ test_loader = CI::Reporter.maybe_quote_filename "#{File.dirname(__FILE__)}/minitest_loader.rb"
12
+ ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{test_loader}"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # Copyright (c) 2012 Alexander Shcherbinin <alexander.shcherbinin@gmail.com>
2
+ # See the file LICENSE.txt included with the distribution for
3
+ # software license details.
4
+
5
+ $: << File.dirname(__FILE__) + "/../../.."
6
+ require 'ci/reporter/minitest'
7
+
8
+ # set defaults
9
+ MiniTest::Unit.runner = CI::Reporter::Runner.new
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -72,8 +72,10 @@ module CI
72
72
  output.push "#{exception.class.name << ":"}" unless exception.class.name =~ /RSpec/
73
73
  output.push @exception.message
74
74
 
75
- @formatter.format_backtrace(@exception.backtrace, @example).each do |backtrace_info|
76
- output.push " #{backtrace_info}"
75
+ [@formatter.format_backtrace(@exception.backtrace, @example)].flatten.each do |backtrace_info|
76
+ backtrace_info.lines.each do |line|
77
+ output.push " #{line}"
78
+ end
77
79
  end
78
80
  output.join "\n"
79
81
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -140,7 +140,7 @@ module CI
140
140
  failures.each do |failure|
141
141
  tag = case failure.class.name
142
142
  when /TestUnitSkipped/ then :skipped
143
- when /TestUnitError/ then :error
143
+ when /TestUnitError/, /MiniTestError/ then :error
144
144
  else :failure end
145
145
 
146
146
  builder.tag!(tag, :type => builder.trunc!(failure.name), :message => builder.trunc!(failure.message)) do
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,5 +1,11 @@
1
+ #--
2
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
3
+ # See the file LICENSE.txt included with the distribution for
4
+ # software license details.
5
+ #++
6
+
1
7
  module CI
2
8
  module Reporter
3
- VERSION = "1.6.9"
9
+ VERSION = "1.7.0"
4
10
  end
5
11
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -32,7 +32,7 @@ describe "ci_reporter ci:setup:testunit task" do
32
32
  @rake["ci:setup:testunit"].invoke
33
33
  ENV["TESTOPTS"].should =~ /test_unit_loader/
34
34
  end
35
-
35
+
36
36
  it "should append to ENV['TESTOPTS'] if it already contains a value" do
37
37
  ENV["TESTOPTS"] = "somevalue".freeze
38
38
  @rake["ci:setup:testunit"].invoke
@@ -54,7 +54,7 @@ describe "ci_reporter ci:setup:rspec task" do
54
54
  restore_env "CI_REPORTS"
55
55
  Rake.application = nil
56
56
  end
57
-
57
+
58
58
  it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
59
59
  @rake["ci:setup:rspec"].invoke
60
60
  ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
@@ -64,7 +64,12 @@ describe "ci_reporter ci:setup:rspec task" do
64
64
  @rake["ci:setup:rspecdoc"].invoke
65
65
  ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
66
66
  end
67
-
67
+
68
+ it "should set ENV['SPEC_OPTS'] to include rspec base formatter if task is ci:setup:rspecbase" do
69
+ @rake["ci:setup:rspecbase"].invoke
70
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecBase/
71
+ end
72
+
68
73
  it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
69
74
  ENV["SPEC_OPTS"] = "somevalue".freeze
70
75
  @rake["ci:setup:rspec"].invoke
@@ -86,7 +91,7 @@ describe "ci_reporter ci:setup:cucumber task" do
86
91
  restore_env "CI_REPORTS"
87
92
  Rake.application = nil
88
93
  end
89
-
94
+
90
95
  it "should set ENV['CUCUMBER_OPTS'] to include cucumber formatter args" do
91
96
  @rake["ci:setup:cucumber"].invoke
92
97
  ENV["CUCUMBER_OPTS"].should =~ /--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -47,4 +47,16 @@ describe "The ReportManager" do
47
47
  File.exist?(filename).should be_true
48
48
  File.open(filename) {|f| f.read.should == "<xml></xml>"}
49
49
  end
50
+
51
+ it "sidesteps existing files by adding an incrementing number" do
52
+ filename = "#{REPORTS_DIR}/SPEC-colliding-test-suite-name.xml"
53
+ FileUtils.mkdir_p(File.dirname(filename))
54
+ FileUtils.touch filename
55
+ reporter = CI::Reporter::ReportManager.new("spec")
56
+ suite = mock("test suite")
57
+ suite.should_receive(:name).and_return("colliding test suite name")
58
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
59
+ reporter.write_report(suite)
60
+ File.exist?(filename.sub('.xml', '.0.xml')).should be_true
61
+ end
50
62
  end
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2011 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -9,6 +9,8 @@ rescue LoadError
9
9
  require 'spec'
10
10
  end
11
11
 
12
+ require 'rspec/autorun' if $0 =~ /rcov$/
13
+
12
14
  unless defined?(CI_REPORTER_LIB)
13
15
  CI_REPORTER_LIB = File.expand_path(File.dirname(__FILE__) + "/../lib")
14
16
  $: << CI_REPORTER_LIB
data/stub.rake CHANGED
@@ -1,8 +1,8 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
  #
5
- # Use this stub rakefile as a wrapper around a regular Rakefile. Run in the
5
+ # Use this stub rakefile as a wrapper around a regular Rakefile. Run in the
6
6
  # same directory as the real Rakefile.
7
7
  #
8
8
  # rake -f /path/to/ci_reporter/lib/ci/reporter/rake/stub.rake ci:setup:rspec default
@@ -11,4 +11,5 @@
11
11
  load File.dirname(__FILE__) + '/lib/ci/reporter/rake/rspec.rb'
12
12
  load File.dirname(__FILE__) + '/lib/ci/reporter/rake/cucumber.rb'
13
13
  load File.dirname(__FILE__) + '/lib/ci/reporter/rake/test_unit.rb'
14
+ load File.dirname(__FILE__) + '/lib/ci/reporter/rake/minitest.rb'
14
15
  load 'Rakefile'
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
1
+ # Copyright (c) 2006-2012 Nick Sieger <nicksieger@gmail.com>
2
2
  # See the file LICENSE.txt included with the distribution for
3
3
  # software license details.
4
4
 
@@ -10,9 +10,11 @@ end
10
10
  require 'ci/reporter/rake/rspec'
11
11
  require 'ci/reporter/rake/cucumber'
12
12
  require 'ci/reporter/rake/test_unit'
13
+ require 'ci/reporter/rake/minitest'
13
14
 
14
15
  namespace :ci do
15
16
  task :setup_rspec => "ci:setup:rspec"
16
17
  task :setup_cucumber => "ci:setup:cucumber"
17
18
  task :setup_testunit => "ci:setup:testunit"
19
+ task :setup_minitest => "ci:setup:minitest"
18
20
  end
metadata CHANGED
@@ -1,141 +1,144 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ci_reporter
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.0
4
5
  prerelease:
5
- version: 1.6.9
6
6
  platform: ruby
7
- authors:
8
- - Nick Sieger
7
+ authors:
8
+ - Nick Sieger
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-12-15 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: builder
17
- version_requirements: &id001 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.1.2
23
- requirement: *id001
24
- prerelease: false
25
- type: :runtime
26
- - !ruby/object:Gem::Dependency
27
- name: rubyforge
28
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 2.0.4
34
- requirement: *id002
35
- prerelease: false
36
- type: :development
37
- - !ruby/object:Gem::Dependency
38
- name: hoe
39
- version_requirements: &id003 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- version: "2.12"
45
- requirement: *id003
46
- prerelease: false
47
- type: :development
48
- - !ruby/object:Gem::Dependency
49
- name: rdoc
50
- version_requirements: &id004 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
55
- version: "3.10"
56
- requirement: *id004
57
- prerelease: false
58
- type: :development
59
- 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.
12
+ date: 2012-01-29 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: builder
16
+ requirement: &70278558357240 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 2.1.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70278558357240
25
+ - !ruby/object:Gem::Dependency
26
+ name: rubyforge
27
+ requirement: &70278558356440 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.0.4
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70278558356440
36
+ - !ruby/object:Gem::Dependency
37
+ name: hoe
38
+ requirement: &70278558355060 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.12'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70278558355060
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdoc
49
+ requirement: &70278566753800 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.10'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70278566753800
58
+ description: CI::Reporter is an add-on to Test::Unit, RSpec and Cucumber that allows
59
+ you to generate XML reports of your test, spec and/or feature runs. The resulting
60
+ files can be read by a continuous integration system that understands Ant's JUnit
61
+ report XML format, thus allowing your CI system to track test/spec successes and
62
+ failures.
60
63
  email: nick@nicksieger.com
61
64
  executables: []
62
-
63
65
  extensions: []
64
-
65
- extra_rdoc_files:
66
- - History.txt
67
- - Manifest.txt
68
- - LICENSE.txt
69
- - README.rdoc
70
- files:
71
- - History.txt
72
- - Manifest.txt
73
- - README.rdoc
74
- - LICENSE.txt
75
- - Rakefile
76
- - stub.rake
77
- - lib/ci/reporter/core.rb
78
- - lib/ci/reporter/cucumber.rb
79
- - lib/ci/reporter/report_manager.rb
80
- - lib/ci/reporter/rspec.rb
81
- - lib/ci/reporter/test_suite.rb
82
- - lib/ci/reporter/test_unit.rb
83
- - lib/ci/reporter/version.rb
84
- - lib/ci/reporter/rake/cucumber.rb
85
- - lib/ci/reporter/rake/cucumber_loader.rb
86
- - lib/ci/reporter/rake/rspec.rb
87
- - lib/ci/reporter/rake/rspec_loader.rb
88
- - lib/ci/reporter/rake/test_unit.rb
89
- - lib/ci/reporter/rake/test_unit_loader.rb
90
- - lib/ci/reporter/rake/utils.rb
91
- - spec/spec_helper.rb
92
- - spec/ci/reporter/cucumber_spec.rb
93
- - spec/ci/reporter/output_capture_spec.rb
94
- - spec/ci/reporter/report_manager_spec.rb
95
- - spec/ci/reporter/rspec_spec.rb
96
- - spec/ci/reporter/test_suite_spec.rb
97
- - spec/ci/reporter/test_unit_spec.rb
98
- - spec/ci/reporter/rake/rake_tasks_spec.rb
99
- - tasks/ci_reporter.rake
66
+ extra_rdoc_files:
67
+ - History.txt
68
+ - LICENSE.txt
69
+ - Manifest.txt
70
+ - README.rdoc
71
+ files:
72
+ - History.txt
73
+ - Manifest.txt
74
+ - README.rdoc
75
+ - LICENSE.txt
76
+ - Rakefile
77
+ - stub.rake
78
+ - lib/ci/reporter/core.rb
79
+ - lib/ci/reporter/cucumber.rb
80
+ - lib/ci/reporter/minitest.rb
81
+ - lib/ci/reporter/rake/cucumber.rb
82
+ - lib/ci/reporter/rake/cucumber_loader.rb
83
+ - lib/ci/reporter/rake/minitest.rb
84
+ - lib/ci/reporter/rake/minitest_loader.rb
85
+ - lib/ci/reporter/rake/rspec.rb
86
+ - lib/ci/reporter/rake/rspec_loader.rb
87
+ - lib/ci/reporter/rake/test_unit.rb
88
+ - lib/ci/reporter/rake/test_unit_loader.rb
89
+ - lib/ci/reporter/rake/utils.rb
90
+ - lib/ci/reporter/report_manager.rb
91
+ - lib/ci/reporter/rspec.rb
92
+ - lib/ci/reporter/test_suite.rb
93
+ - lib/ci/reporter/test_unit.rb
94
+ - lib/ci/reporter/version.rb
95
+ - spec/ci/reporter/cucumber_spec.rb
96
+ - spec/ci/reporter/output_capture_spec.rb
97
+ - spec/ci/reporter/rake/rake_tasks_spec.rb
98
+ - spec/ci/reporter/report_manager_spec.rb
99
+ - spec/ci/reporter/rspec_spec.rb
100
+ - spec/ci/reporter/test_suite_spec.rb
101
+ - spec/ci/reporter/test_unit_spec.rb
102
+ - spec/spec_helper.rb
103
+ - tasks/ci_reporter.rake
100
104
  homepage: http://caldersphere.rubyforge.org/ci_reporter
101
105
  licenses: []
102
-
103
106
  post_install_message:
104
- rdoc_options:
105
- - --main
106
- - README.rdoc
107
- - -SHN
108
- - -f
109
- - darkfish
110
- require_paths:
111
- - lib
112
- required_ruby_version: !ruby/object:Gem::Requirement
107
+ rdoc_options:
108
+ - --main
109
+ - README.rdoc
110
+ - -SHN
111
+ - -f
112
+ - darkfish
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
113
116
  none: false
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- hash: 2
118
- segments:
119
- - 0
120
- version: "0"
121
- required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ segments:
122
+ - 0
123
+ hash: 1021728402705667468
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
125
  none: false
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: "0"
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
127
130
  requirements: []
128
-
129
131
  rubyforge_project: caldersphere
130
- rubygems_version: 1.8.9
132
+ rubygems_version: 1.8.6
131
133
  signing_key:
132
134
  specification_version: 3
133
- summary: CI::Reporter allows you to generate reams of XML for use with continuous integration systems.
134
- test_files:
135
- - spec/ci/reporter/cucumber_spec.rb
136
- - spec/ci/reporter/output_capture_spec.rb
137
- - spec/ci/reporter/report_manager_spec.rb
138
- - spec/ci/reporter/rspec_spec.rb
139
- - spec/ci/reporter/test_suite_spec.rb
140
- - spec/ci/reporter/test_unit_spec.rb
141
- - spec/ci/reporter/rake/rake_tasks_spec.rb
135
+ summary: CI::Reporter allows you to generate reams of XML for use with continuous
136
+ integration systems.
137
+ test_files:
138
+ - spec/ci/reporter/cucumber_spec.rb
139
+ - spec/ci/reporter/output_capture_spec.rb
140
+ - spec/ci/reporter/rake/rake_tasks_spec.rb
141
+ - spec/ci/reporter/report_manager_spec.rb
142
+ - spec/ci/reporter/rspec_spec.rb
143
+ - spec/ci/reporter/test_suite_spec.rb
144
+ - spec/ci/reporter/test_unit_spec.rb