Class: ExampleGroupTimer::Formatter

Inherits:
RSpec::Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/example_group_timer/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



8
9
10
11
# File 'lib/example_group_timer/formatter.rb', line 8

def initialize(output)
  super
  self.current_group = RootTimedGroup.new
end

Instance Attribute Details

#current_groupObject

Returns the value of attribute current_group.



6
7
8
# File 'lib/example_group_timer/formatter.rb', line 6

def current_group
  @current_group
end

#groupsObject (readonly)

Returns the value of attribute groups.



5
6
7
# File 'lib/example_group_timer/formatter.rb', line 5

def groups
  @groups
end

Instance Method Details

#dump_summary(*args) ⇒ Object



50
51
52
53
# File 'lib/example_group_timer/formatter.rb', line 50

def dump_summary(*args)
  current_group.report
  super
end

#example_failed(example) ⇒ Object



35
36
37
38
# File 'lib/example_group_timer/formatter.rb', line 35

def example_failed(example)
  super
  current_group.finish_current_example
end

#example_group_finished(group) ⇒ Object



19
20
21
22
23
# File 'lib/example_group_timer/formatter.rb', line 19

def example_group_finished(group)
  super
  current_group.finish
  self.current_group = current_group.parent
end

#example_group_started(group) ⇒ Object



13
14
15
16
17
# File 'lib/example_group_timer/formatter.rb', line 13

def example_group_started(group)
  super
  g = current_group.add_group(group)
  self.current_group = g
end

#example_passed(example) ⇒ Object



40
41
42
43
# File 'lib/example_group_timer/formatter.rb', line 40

def example_passed(example)
  super
  current_group.finish_current_example
end

#example_pending(example) ⇒ Object



30
31
32
33
# File 'lib/example_group_timer/formatter.rb', line 30

def example_pending(example)
  super
  current_group.finish_current_example
end

#example_started(example) ⇒ Object



25
26
27
28
# File 'lib/example_group_timer/formatter.rb', line 25

def example_started(example)
  super
  current_group.add_example example
end

#stopObject



45
46
47
48
# File 'lib/example_group_timer/formatter.rb', line 45

def stop
  super
  current_group.finish
end