Class: Lucian::CustomFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/lucian/custom_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ CustomFormatter

Returns a new instance of CustomFormatter.



8
9
10
# File 'lib/lucian/custom_formatter.rb', line 8

def initialize output
  @output = output
end

Instance Method Details

#close(notification) ⇒ Object



42
43
44
# File 'lib/lucian/custom_formatter.rb', line 42

def close notification
  @output << "\n"
end

#dump_failures(notification) ⇒ Object



31
32
33
34
35
36
# File 'lib/lucian/custom_formatter.rb', line 31

def dump_failures notification
  if notification.failed_examples.length > 0
    @output << "\n#{RSpec::Core::Formatters::ConsoleCodes.wrap("FAILING:", :failure)}\n"
    @output << failed_examples_output(notification)
  end
end

#dump_pending(notification) ⇒ Object



24
25
26
27
28
29
# File 'lib/lucian/custom_formatter.rb', line 24

def dump_pending notification
  if notification.pending_examples.length > 0
    @output << "\n\n#{RSpec::Core::Formatters::ConsoleCodes.wrap("PENDING:", :pending)}\n"
    @output << notification.pending_examples.map {|example| "|=:" + example.full_description + ":|-|:" + example.location + ":=|" }.join("\n")
  end
end

#dump_summary(notification) ⇒ Object



38
39
40
# File 'lib/lucian/custom_formatter.rb', line 38

def dump_summary notification
  @output << "\n\nFinished in #{RSpec::Core::Formatters::Helpers.format_duration(notification.duration)}."
end

#example_failed(notification) ⇒ Object



16
17
18
# File 'lib/lucian/custom_formatter.rb', line 16

def example_failed notification
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nFAILED", :failure)
end

#example_passed(notification) ⇒ Object



12
13
14
# File 'lib/lucian/custom_formatter.rb', line 12

def example_passed notification
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nPASSED", :success)
end

#example_pending(notification) ⇒ Object



20
21
22
# File 'lib/lucian/custom_formatter.rb', line 20

def example_pending notification
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nPENDED", :pending)
end