Permalink
Browse files

fix nil to_xs with CI_CAPTURE=off

  • Loading branch information...
1 parent c801e30 commit 55b70f35a080048b816a9892d486ed99bc389057 @seanwalbran seanwalbran committed Dec 14, 2011
Showing with 11 additions and 2 deletions.
  1. +2 −2 lib/ci/reporter/test_suite.rb
  2. +9 −0 spec/ci/reporter/test_suite_spec.rb
View
4 lib/ci/reporter/test_suite.rb
@@ -86,10 +86,10 @@ def builder.trunc!(txt)
tc.to_xml(builder)
end
builder.tag! "system-out" do
- builder.text! self.stdout
+ builder.text!(self.stdout || '' )
end
builder.tag! "system-err" do
- builder.text! self.stderr
+ builder.text!(self.stderr || '' )
end
end
end
View
9 spec/ci/reporter/test_suite_spec.rb
@@ -53,6 +53,7 @@ def name.to_s; "object name"; end
describe "TestSuite xml" do
before(:each) do
+ ENV['CI_CAPTURE'] = nil
@suite = CI::Reporter::TestSuite.new("example suite")
@suite.assertions = 11
begin
@@ -62,6 +63,14 @@ def name.to_s; "object name"; end
end
end
+ it "should render successfully with CI_CAPTURE off" do
+ ENV['CI_CAPTURE'] = 'off'
+ @suite.start
+ @suite.testcases << CI::Reporter::TestCase.new("example test")
+ @suite.finish
+ xml = @suite.to_xml
+ end
+
it "should contain Ant/JUnit-formatted description of entire suite" do
failure = mock("failure")
failure.stub!(:failure?).and_return true

0 comments on commit 55b70f3

Please sign in to comment.