Skip to content
Browse files

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.
  • Loading branch information...
1 parent e336700 commit 20153f8e790100b0feac6b1f5d900a1cc2574e8b Brendan Boesen committed Apr 26, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 spec/ci/reporter/report_manager_spec.rb
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

0 comments on commit 20153f8

Please sign in to comment.
Something went wrong with that request. Please try again.