Sha256: dff9af0a1933e574f7ac2892b6918d543ec8450ce6c12b425405fd75def59ede

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 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"
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

6 entries across 6 versions & 1 rubygems

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