Class: CI::Reporter::RSpec

Inherits:
Spec::Runner::Formatter::ProgressBarFormatter
  • Object
show all
Defined in:
lib/ci/reporter/rspec.rb

Overview

Custom RSpec formatter used to hook into the spec runs and capture results.

Instance Method Summary collapse

Constructor Details

#initialize(output, dry_run = false, colour = false, report_mgr = nil) ⇒ RSpec

Returns a new instance of RSpec.



28
29
30
31
32
# File 'lib/ci/reporter/rspec.rb', line 28

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

Instance Method Details

#add_context(name, first) ⇒ Object



38
39
40
41
42
43
# File 'lib/ci/reporter/rspec.rb', line 38

def add_context(name, first)
  super
  write_report if @suite
  @suite = TestSuite.new name
  @suite.start
end

#dump_failure(counter, failure) ⇒ Object



69
70
71
# File 'lib/ci/reporter/rspec.rb', line 69

def dump_failure(counter, failure)
  super
end

#dump_summary(duration, spec_count, failure_count) ⇒ Object



73
74
75
76
# File 'lib/ci/reporter/rspec.rb', line 73

def dump_summary(duration, spec_count, failure_count)
  super
  write_report
end

#spec_failed(name, counter, failure) ⇒ Object



52
53
54
55
56
57
# File 'lib/ci/reporter/rspec.rb', line 52

def spec_failed(name, counter, failure)
  super
  spec = @suite.testcases.last
  spec.finish
  spec.failure = RSpecFailure.new(failure)
end

#spec_passed(name) ⇒ Object



59
60
61
62
63
# File 'lib/ci/reporter/rspec.rb', line 59

def spec_passed(name)
  super
  spec = @suite.testcases.last
  spec.finish
end

#spec_started(name) ⇒ Object



45
46
47
48
49
50
# File 'lib/ci/reporter/rspec.rb', line 45

def spec_started(name)
  super
  spec = TestCase.new name
  @suite.testcases << spec
  spec.start
end

#start(spec_count) ⇒ Object



34
35
36
# File 'lib/ci/reporter/rspec.rb', line 34

def start(spec_count)
  super
end

#start_dumpObject



65
66
67
# File 'lib/ci/reporter/rspec.rb', line 65

def start_dump
  super
end