Permalink
Browse files

Adding some specs to improve coverage

  • Loading branch information...
1 parent c38bb8a commit c423e61ff8b69d2031e4859d6b96d2c11f91c613 @nicksieger nicksieger committed Jan 28, 2012
Showing with 21 additions and 4 deletions.
  1. +9 −4 spec/ci/reporter/rake/rake_tasks_spec.rb
  2. +12 −0 spec/ci/reporter/report_manager_spec.rb
@@ -32,7 +32,7 @@ def restore_env(v)
@rake["ci:setup:testunit"].invoke
ENV["TESTOPTS"].should =~ /test_unit_loader/
end
-
+
it "should append to ENV['TESTOPTS'] if it already contains a value" do
ENV["TESTOPTS"] = "somevalue".freeze
@rake["ci:setup:testunit"].invoke
@@ -54,7 +54,7 @@ def restore_env(v)
restore_env "CI_REPORTS"
Rake.application = nil
end
-
+
it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do
@rake["ci:setup:rspec"].invoke
ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
@@ -64,7 +64,12 @@ def restore_env(v)
@rake["ci:setup:rspecdoc"].invoke
ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
end
-
+
+ it "should set ENV['SPEC_OPTS'] to include rspec base formatter if task is ci:setup:rspecbase" do
+ @rake["ci:setup:rspecbase"].invoke
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecBase/
+ end
+
it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
ENV["SPEC_OPTS"] = "somevalue".freeze
@rake["ci:setup:rspec"].invoke
@@ -86,7 +91,7 @@ def restore_env(v)
restore_env "CI_REPORTS"
Rake.application = nil
end
-
+
it "should set ENV['CUCUMBER_OPTS'] to include cucumber formatter args" do
@rake["ci:setup:cucumber"].invoke
ENV["CUCUMBER_OPTS"].should =~ /--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
@@ -47,4 +47,16 @@
File.exist?(filename).should be_true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end
+
+ it "sidesteps existing files by adding an incrementing number" do
+ filename = "#{REPORTS_DIR}/SPEC-colliding-test-suite-name.xml"
+ FileUtils.mkdir_p(File.dirname(filename))
+ FileUtils.touch filename
+ reporter = CI::Reporter::ReportManager.new("spec")
+ suite = mock("test suite")
+ suite.should_receive(:name).and_return("colliding test suite name")
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
+ reporter.write_report(suite)
+ File.exist?(filename.sub('.xml', '.0.xml')).should be_true
+ end
end

0 comments on commit c423e61

Please sign in to comment.