Sha256: 71dc41027c86e155c7850f0849a2a6c0b159fb58860131613f35b150366239cb
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
require 'ci/reporter/core' gem 'rspec' require 'spec' module CI module Reporter # Wrapper around a <code>RSpec</code> error or failure to be used by the test suite to interpret results. class RSpecFailure def initialize(failure) @failure = failure end def failure? @failure.expectation_not_met? end def error? !@failure.expectation_not_met? end def name() @failure.exception.class.name end def message() @failure.exception.message end def location() @failure.exception.backtrace.join("\n") end end # Custom +RSpec+ formatter used to hook into the spec runs and capture results. class RSpec < Spec::Runner::Formatter::ProgressBarFormatter def initialize(output, dry_run=false, colour=false, report_mgr=nil) super(output, dry_run, colour) @report_manager = report_mgr || ReportManager.new("spec") @suite = nil end def start(spec_count) super end def add_context(name, first) super write_report if @suite @suite = TestSuite.new name @suite.start end def spec_started(name) super spec = TestCase.new name @suite.testcases << spec spec.start end def spec_failed(name, counter, failure) super spec = @suite.testcases.last spec.finish spec.failure = RSpecFailure.new(failure) end def spec_passed(name) super spec = @suite.testcases.last spec.finish end def start_dump super end def dump_failure(counter, failure) super end def dump_summary(duration, spec_count, failure_count) super write_report end private def write_report @suite.finish @report_manager.write_report(@suite) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ci_reporter-1.1 | lib/ci/reporter/rspec.rb |
ci_reporter-1.2 | lib/ci/reporter/rspec.rb |
ci_reporter-1.0 | lib/ci/reporter/rspec.rb |