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.



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ci/reporter/rspec.rb', line 37

def initialize(output, dry_run=false, colour=false, report_mgr=nil)
  if respond_to? :dry_run=
    super(output)
    self.dry_run=dry_run
    self.colour=colour
  else
    super(output, dry_run, colour)
  end
  @report_manager = report_mgr || ReportManager.new("spec")
  @suite = nil
end

Instance Method Details

#add_behaviour(name) ⇒ Object

Post-0.9 hook



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

def add_behaviour(name)
  super
  new_suite(name)
end

#add_context(name, first) ⇒ Object

Pre-0.9 hook



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

def add_context(name, first)
  super
  new_suite(name)
end

#dump_failure(counter, failure) ⇒ Object



105
106
107
# File 'lib/ci/reporter/rspec.rb', line 105

def dump_failure(counter, failure)
  super
end

#dump_summary(duration, example_count, failure_count, not_implemented_count = 0) ⇒ Object



109
110
111
112
113
114
115
116
# File 'lib/ci/reporter/rspec.rb', line 109

def dump_summary(duration, example_count, failure_count, not_implemented_count = 0)
  begin
    super
  rescue ArgumentError
    super(duration, example_count, failure_count)
  end
  write_report
end

#example_failed(name, counter, failure) ⇒ Object

Post-0.9 hook



84
85
86
87
# File 'lib/ci/reporter/rspec.rb', line 84

def example_failed(name, counter, failure)
  super
  case_failed(name, counter, failure)
end

#example_passed(name) ⇒ Object

Post-0.9 hook



96
97
98
99
# File 'lib/ci/reporter/rspec.rb', line 96

def example_passed(name)
  super
  case_passed(name)
end

#example_started(name) ⇒ Object

Post-0.9 hook



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

def example_started(name)
  super
  case_started(name)
end

#spec_failed(name, counter, failure) ⇒ Object

Pre-0.9 hook



78
79
80
81
# File 'lib/ci/reporter/rspec.rb', line 78

def spec_failed(name, counter, failure)
  super
  case_failed(name, counter, failure)
end

#spec_passed(name) ⇒ Object

Pre-0.9 hook



90
91
92
93
# File 'lib/ci/reporter/rspec.rb', line 90

def spec_passed(name)
  super
  case_passed(name)
end

#spec_started(name) ⇒ Object

Pre-0.9 hook



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

def spec_started(name)
  super
  case_started(name)
end

#start(spec_count) ⇒ Object



49
50
51
# File 'lib/ci/reporter/rspec.rb', line 49

def start(spec_count)
  super
end

#start_dumpObject



101
102
103
# File 'lib/ci/reporter/rspec.rb', line 101

def start_dump
  super
end