Sha256: 982d5efa13155c76b3c44258a49f5ccd21e1df011d885d6e547a18c2bd2c1ce3

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

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

context "The RSpec reporter" do
  setup do
    @error = mock("error")
    @error.stub!(:exception).and_return do
      begin
        raise StandardError, "error message"
      rescue => e
        e
      end
    end
    @error.stub!(:expectation_not_met?).and_return(false)
    @report_mgr = mock("report manager")
    @fmt = CI::Reporter::RSpec.new(StringIO.new(""), false, false, @report_mgr)
  end

  specify "should create a test suite with one success and one failure" do
    @report_mgr.should_receive(:write_report).and_return do |suite|
      suite.testcases.length.should == 2
      suite.testcases.first.should_not_be_failure
      suite.testcases.first.should_not_be_error
      suite.testcases.last.should_be_error
    end

    @fmt.start(2)
    @fmt.add_context("A context", true)
    @fmt.spec_started("should pass")
    @fmt.spec_passed("should pass")
    @fmt.spec_started("should fail")
    @fmt.spec_failed("should fail", 1, @error)
    @fmt.dump_summary(0.1, 2, 1)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ci_reporter-1.0 spec/ci/reporter/rspec_spec.rb
ci_reporter-1.1 spec/ci/reporter/rspec_spec.rb
ci_reporter-1.2 spec/ci/reporter/rspec_spec.rb