Class: CI::Reporter::RSpec3::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/rspec3/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Formatter

Returns a new instance of Formatter.



9
10
11
# File 'lib/ci/reporter/rspec3/formatter.rb', line 9

def initialize(*args)
  @report_manager = ReportManager.new("spec")
end

Instance Attribute Details

#report_managerObject

Returns the value of attribute report_manager.



7
8
9
# File 'lib/ci/reporter/rspec3/formatter.rb', line 7

def report_manager
  @report_manager
end

Instance Method Details

#example_failed(notification) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/ci/reporter/rspec3/formatter.rb', line 23

def example_failed(notification)
  # In case we fail in before(:all)
  example_started(nil) if @suite.testcases.empty?

  failure = Failure.new(notification)

  current_spec.finish
  current_spec.name = notification.example.full_description
  current_spec.failures << failure
end

#example_group_started(notification) ⇒ Object



13
14
15
# File 'lib/ci/reporter/rspec3/formatter.rb', line 13

def example_group_started(notification)
  new_suite(notification.group.[:full_description])
end

#example_passed(notification) ⇒ Object



34
35
36
37
# File 'lib/ci/reporter/rspec3/formatter.rb', line 34

def example_passed(notification)
  current_spec.finish
  current_spec.name = notification.example.full_description
end

#example_pending(notification) ⇒ Object



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

def example_pending(notification)
  current_spec.finish
  current_spec.name = "#{notification.example.full_description} (PENDING)"
  current_spec.skipped = true
end

#example_started(notification) ⇒ Object



17
18
19
20
21
# File 'lib/ci/reporter/rspec3/formatter.rb', line 17

def example_started(notification)
  spec = TestCase.new
  @suite.testcases << spec
  spec.start
end

#stop(notification) ⇒ Object



45
46
47
# File 'lib/ci/reporter/rspec3/formatter.rb', line 45

def stop(notification)
  write_report
end