ci_reporter 1.3.2 → 1.3.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.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.3.3
2
+
3
+ - Use SPEC_OPTS instead of RSPECOPTS (Aslak Hellesøy)
4
+ - Add assertions attribute to individual test cases (Tracker #11563, Andy Sipe)
5
+
1
6
  == 1.3.2
2
7
 
3
8
  - Fix bug trying to modify frozen environment strings
data/README.txt CHANGED
@@ -2,9 +2,7 @@ CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate XM
2
2
 
3
3
  == Dependencies
4
4
 
5
- CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing.
6
-
7
- *NOTE*: As of this release, CI::Reporter is only compatible with RSpec up through version 0.8.2. The 0.9 series has introduced an incompatibility that has not been rectified yet.
5
+ CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing. CI::Reporter will raise an exception at runtime if it cannot locate Builder.
8
6
 
9
7
  == Installation
10
8
 
@@ -18,7 +16,7 @@ To use CI::Reporter as a Rails plugin, first install the gem, and then install t
18
16
 
19
17
  == Usage
20
18
 
21
- CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or specs, respectively. In this fashion, it hooks into <code>Test::Unit</code> or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2.
19
+ CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or examples, respectively. In this fashion, it hooks into <code>Test::Unit</code> or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2.
22
20
 
23
21
  1. To use CI::Reporter, simply add the following lines to your Rakefile:
24
22
 
@@ -49,6 +47,12 @@ There's a bit of a chicken and egg problem because rubygems needs to be loaded b
49
47
  * +CI_REPORTS+: if set, points to a directory where report files will be written.
50
48
  * +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled.
51
49
 
50
+ == Source
51
+
52
+ CI::Reporter source is not currently located in Rubyforge's SVN. To get the source:
53
+
54
+ svn co http://svn.caldersphere.net/svn/main/rubyforge/ci_reporter/trunk ci_reporter
55
+
52
56
  == License
53
57
 
54
58
  This software is released under an MIT license. For details, see the LICENSE.txt file included with the distribution. The software is copyright (c) 2006-2007 Nick Sieger <nicksieger@gmail.com>.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt",
5
5
 
6
6
  begin
7
7
  require 'hoe'
8
- hoe = Hoe.new("ci_reporter", "1.3.2") do |p|
8
+ hoe = Hoe.new("ci_reporter", "1.3.3") do |p|
9
9
  p.rubyforge_name = "caldersphere"
10
10
  p.url = "http://caldersphere.rubyforge.org/ci_reporter"
11
11
  p.author = "Nick Sieger"
@@ -6,9 +6,14 @@ namespace :ci do
6
6
  namespace :setup do
7
7
  task :rspec do
8
8
  rm_rf ENV["CI_REPORTS"] || "spec/reports"
9
+
10
+ spec_opts = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
11
+ "--format", "CI::Reporter::RSpec"].join(" ")
12
+ ENV["SPEC_OPTS"] ||= ""
13
+ ENV["SPEC_OPTS"] += spec_opts
14
+ # Pre RSpec 1.0.6
9
15
  ENV["RSPECOPTS"] ||= ""
10
- ENV["RSPECOPTS"] += [" --require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
11
- "--format", "CI::Reporter::RSpec"].join(" ")
16
+ ENV["RSPECOPTS"] += spec_opts
12
17
  end
13
18
  end
14
19
  end
@@ -111,7 +111,7 @@ module CI
111
111
  end
112
112
 
113
113
  # Structure used to represent an individual test case. Used to time the test and store the result.
114
- class TestCase < Struct.new(:name, :time)
114
+ class TestCase < Struct.new(:name, :time, :assertions)
115
115
  attr_accessor :failure
116
116
 
117
117
  # Starts timing the test.
@@ -137,7 +137,7 @@ module CI
137
137
  # Writes xml representing the test result to the provided builder.
138
138
  def to_xml(builder)
139
139
  attrs = {}
140
- each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) }
140
+ each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty?}
141
141
  builder.testcase(attrs) do
142
142
  if failure
143
143
  builder.failure(:type => builder.trunc!(failure.name), :message => builder.trunc!(failure.message)) do
@@ -57,6 +57,7 @@ module CI
57
57
  @last_assertion_count = 0
58
58
  @current_suite = nil
59
59
  @unknown_count = 0
60
+ @result_assertion_count = 0
60
61
  end
61
62
 
62
63
  def test_started(name)
@@ -115,6 +116,8 @@ module CI
115
116
  tc = @current_suite.testcases.last
116
117
  tc.finish
117
118
  tc.failure = Failure.new(failure) if failure
119
+ tc.assertions = @suite_result.assertion_count - @result_assertion_count
120
+ @result_assertion_count = @suite_result.assertion_count
118
121
  end
119
122
  end
120
123
  end
@@ -46,23 +46,23 @@ describe "ci_reporter ci:setup:rspec task" do
46
46
  Rake.application = @rake
47
47
  load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb'
48
48
  save_env "CI_REPORTS"
49
- save_env "RSPECOPTS"
49
+ save_env "SPEC_OPTS"
50
50
  ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
51
51
  end
52
52
  after(:each) do
53
- restore_env "RSPECOPTS"
53
+ restore_env "SPEC_OPTS"
54
54
  restore_env "CI_REPORTS"
55
55
  Rake.application = nil
56
56
  end
57
57
 
58
- it "should set ENV['RSPECOPTS'] to include rspec formatter args" do
58
+ it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
59
59
  @rake["ci:setup:rspec"].invoke
60
- ENV["RSPECOPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
60
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
61
61
  end
62
62
 
63
- it "should append to ENV['RSPECOPTS'] if it already contains a value" do
64
- ENV["RSPECOPTS"] = "somevalue".freeze
63
+ it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
64
+ ENV["SPEC_OPTS"] = "somevalue".freeze
65
65
  @rake["ci:setup:rspec"].invoke
66
- ENV["RSPECOPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
66
+ ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
67
67
  end
68
68
  end
@@ -47,9 +47,12 @@ describe "The TestUnit reporter" do
47
47
  @suites.first.name.should == "TestCaseClass"
48
48
  @suites.first.testcases.length.should == 1
49
49
  @suites.first.testcases.first.name.should == "test_one"
50
+ @suites.first.testcases.first.assertions.should == 7
51
+
50
52
  @suites.last.name.should == "AnotherTestCaseClass"
51
53
  @suites.last.testcases.length.should == 1
52
54
  @suites.last.testcases.first.name.should == "test_two"
55
+ @suites.last.testcases.first.assertions.should == 0
53
56
  end
54
57
 
55
58
  it "should record assertion counts during test run" do
@@ -62,6 +65,7 @@ describe "The TestUnit reporter" do
62
65
  @testunit.finished(10)
63
66
 
64
67
  @suite.assertions.should == 7
68
+ @suite.testcases.last.assertions.should == 7
65
69
  end
66
70
 
67
71
  it "should add failures to testcases when encountering a fault" do
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ci_reporter
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.3.2
7
- date: 2007-06-06 00:00:00 -07:00
6
+ version: 1.3.3
7
+ date: 2007-06-18 00:00:00 -05:00
8
8
  summary: CI::Reporter allows you to generate reams of XML for use with continuous integration systems.
9
9
  require_paths:
10
10
  - lib