Sha256: dca6b6b40a7e12ec1d5a8f519f2d30cc48c90c147eb99c817672a9bdb30fd1ec

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

# (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.

require File.dirname(__FILE__) + "/../../spec_helper.rb"

context "The ReportManager" do
  setup do
    @reports_dir = REPORTS_DIR
  end

  teardown do
    FileUtils.rm_rf @reports_dir
    ENV["CI_REPORTS"] = nil
  end

  specify "should create the report directory according to the given prefix" do
    CI::Reporter::ReportManager.new("spec")
    File.directory?(@reports_dir).should_be true
  end
  
  specify "should create the report directory based on CI_REPORTS environment variable if set" do
    @reports_dir = "#{Dir.getwd}/dummy"
    ENV["CI_REPORTS"] = @reports_dir
    CI::Reporter::ReportManager.new("spec")
    File.directory?(@reports_dir).should_be true
  end
  
  specify "should write reports based on name and xml content of a test suite" do
    reporter = CI::Reporter::ReportManager.new("spec")
    suite = mock("test suite")
    suite.should_receive(:name).and_return("some test suite name")
    suite.should_receive(:to_xml).and_return("<xml></xml>")
    reporter.write_report(suite)
    filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name.xml"
    File.exist?(filename).should_be true
    File.open(filename) {|f| f.read.should == "<xml></xml>"}
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ci_reporter-1.2.4 spec/ci/reporter/report_manager_spec.rb
ci_reporter-1.2.1 spec/ci/reporter/report_manager_spec.rb
ci_reporter-1.2.2 spec/ci/reporter/report_manager_spec.rb
ci_reporter-1.2.3 spec/ci/reporter/report_manager_spec.rb
ci_reporter-1.3.1 spec/ci/reporter/report_manager_spec.rb
ci_reporter-1.3 spec/ci/reporter/report_manager_spec.rb