Class: Rfc::Announce

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/rfc/announce.rb

Direct Known Subclasses

Aif

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Announce

Returns a new instance of Announce.



12
13
14
15
# File 'lib/rfc/announce.rb', line 12

def initialize(output)
  super
  @group_level = 0
end

Instance Method Details

#example_failed(failure) ⇒ Object



43
44
45
# File 'lib/rfc/announce.rb', line 43

def example_failed(failure)
  output.puts failure_output(failure.example)
end

#example_group_finished(_notification) ⇒ Object



24
25
26
# File 'lib/rfc/announce.rb', line 24

def example_group_finished(_notification)
  @group_level -= 1 if @group_level > 0
end

#example_group_started(notification) ⇒ Object



17
18
19
20
21
22
# File 'lib/rfc/announce.rb', line 17

def example_group_started(notification)
  output.puts if @group_level == 0
  output.puts "#{current_indentation}#{notification.group.description.strip}"

  @group_level += 1
end

#example_passed(passed) ⇒ Object



34
35
36
# File 'lib/rfc/announce.rb', line 34

def example_passed(passed)
  output.puts passed_output(passed.example)
end

#example_pending(pending) ⇒ Object



38
39
40
41
# File 'lib/rfc/announce.rb', line 38

def example_pending(pending)
  output.puts pending_output(pending.example,
                             pending.example.execution_result.pending_message)
end

#example_started(notification) ⇒ Object



28
29
30
31
32
# File 'lib/rfc/announce.rb', line 28

def example_started(notification)
  example = notification.example
  output.puts(RSpec::Core::Formatters::ConsoleCodes.wrap(
    "#{current_indentation}#{example.description.strip}...", :blue))
end