From a5d3b65ee203507783c175744b9634df022c6597 Mon Sep 17 00:00:00 2001 From: Nick Sieger Date: Fri, 26 Mar 2010 11:14:26 -0500 Subject: [PATCH] GH #1: Fix output in system-out/system-err --- History.txt | 5 +++++ acceptance/test_unit_example_test.rb | 1 + acceptance/verification_spec.rb | 3 +++ lib/ci/reporter/test_suite.rb | 4 ++-- spec/ci/reporter/output_capture_spec.rb | 4 ++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/History.txt b/History.txt index 55dbb7e..3d220e0 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,8 @@ +== 1.6.2 + +- GH #1: Properly escape text in system-out and system-err tags (Matt Kanwisher) +- GH #2: Report rspec before(:all) failures (Edgars Beigarts) + == 1.6.1 - Add 'skipped' flag for pending RSpec examples (Aaron Unger) diff --git a/acceptance/test_unit_example_test.rb b/acceptance/test_unit_example_test.rb index 18f60ef..c88e6c3 100644 --- a/acceptance/test_unit_example_test.rb +++ b/acceptance/test_unit_example_test.rb @@ -3,6 +3,7 @@ class TestUnitExampleTestOne < Test::Unit::TestCase def test_one + puts "Some " assert(false, "First failure") end def teardown diff --git a/acceptance/verification_spec.rb b/acceptance/verification_spec.rb index e0b4666..fe0e8ad 100644 --- a/acceptance/verification_spec.rb +++ b/acceptance/verification_spec.rb @@ -18,6 +18,9 @@ doc.root.attributes["tests"].should == "1" doc.root.elements.to_a("/testsuite/testcase").size.should == 1 doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 2 + doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e| + c << e.value; c + end.strip.should == "Some " end it "should have no errors or failures for TestUnitExampleTestTwo" do diff --git a/lib/ci/reporter/test_suite.rb b/lib/ci/reporter/test_suite.rb index 7131dba..c71206c 100644 --- a/lib/ci/reporter/test_suite.rb +++ b/lib/ci/reporter/test_suite.rb @@ -92,10 +92,10 @@ def builder.trunc!(txt) tc.to_xml(builder) end builder.tag! "system-out" do - builder.cdata! self.stdout + builder.text! self.stdout end builder.tag! "system-err" do - builder.cdata! self.stderr + builder.text! self.stderr end end end diff --git a/spec/ci/reporter/output_capture_spec.rb b/spec/ci/reporter/output_capture_spec.rb index 62a2987..6e5fa35 100644 --- a/spec/ci/reporter/output_capture_spec.rb +++ b/spec/ci/reporter/output_capture_spec.rb @@ -28,8 +28,8 @@ root = REXML::Document.new(@suite.to_xml).root root.elements.to_a('//system-out').length.should == 1 root.elements.to_a('//system-err').length.should == 1 - root.elements.to_a('//system-out').first.cdatas.first.to_s.should == "Hello\n" - root.elements.to_a('//system-err').first.cdatas.first.to_s.should == "Hi" + root.elements.to_a('//system-out').first.texts.first.to_s.strip.should == "Hello" + root.elements.to_a('//system-err').first.texts.first.to_s.strip.should == "Hi" end it "should return $stdout and $stderr to original value after finish" do