Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed failing spec plus fixed bug when calling system commands through back-ticks #56

Merged
merged 2 commits into from

3 participants

@orlanthi

Hi Nick,

I've just committed a couple of changes to my fork - one to fix a failing spec and one to fix a bug when back-ticked commands are called as part of a test. The commit messages should be fairly self-explanatory.

It would be nice if the output of a back-ticked command was also captured in the xml but I don't know how to make that happen (I tried creating a test case to look at the test suite output but nothing came through).

Regards,

Brendan

Brendan Boesen added some commits
Brendan Boesen Fixed failing spec.
The spec was failing because it relied on a hard-coded expectation of the shortened file path and the actual path depends on where you have the project checked-out.
20153f8
Brendan Boesen Fixed bug where back-tick system calls where failing.
When making a system call using back-ticks, eg: /Users/brendanboesen/Documents/projects/ci_reporter, the call was failing because  was set to nil.
This turned out to be a bug in the initialization of the Delegate where the delegate instance (currently nil) was passed to the 'assign' block instead of the captured IO stream.
9dfda81
@cheald

+1

@nicksieger nicksieger merged commit 9dfda81 into ci-reporter:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 26, 2012
  1. Fixed failing spec.

    Brendan Boesen authored
    The spec was failing because it relied on a hard-coded expectation of the shortened file path and the actual path depends on where you have the project checked-out.
  2. Fixed bug where back-tick system calls where failing.

    Brendan Boesen authored
    When making a system call using back-ticks, eg: /Users/brendanboesen/Documents/projects/ci_reporter, the call was failing because  was set to nil.
    This turned out to be a bug in the initialization of the Delegate where the delegate instance (currently nil) was passed to the 'assign' block instead of the captured IO stream.
This page is out of date. Refresh to see the latest.
View
2  lib/ci/reporter/test_suite.rb
@@ -29,7 +29,7 @@ def capture(io, &assign)
@delegate_io = io
@captured_io = StringIO.new
@assign_block = assign
- @assign_block.call self
+ @assign_block.call @captured_io
end
# Finalize the capture and reset to the original IO object.
View
7 spec/ci/reporter/output_capture_spec.rb
@@ -54,4 +54,11 @@
@suite.stdout.should == "B"
@suite.stderr.should == "B"
end
+
+ it "should not barf when commands are executed with back-ticks" do
+ @suite.start
+ `echo "B"`
+ @suite.finish
+ end
+
end
View
5 spec/ci/reporter/report_manager_spec.rb
@@ -40,10 +40,11 @@
it "should shorten extremely long report filenames" do
reporter = CI::Reporter::ReportManager.new("spec")
suite = mock("test suite")
- 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")
+ very_long_name = "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"
+ suite.should_receive(:name).and_return(very_long_name)
suite.should_receive(:to_xml).and_return("<xml></xml>")
reporter.write_report(suite)
- 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"
+ filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..CI::Reporter::ReportManager::MAX_FILENAME_SIZE].gsub(/\s/, '-') + ".xml"
File.exist?(filename).should be_true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end
Something went wrong with that request. Please try again.