Class: RSpec::Ci::Prettify::Formatter

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/rspec/ci/prettify/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



16
17
18
# File 'lib/rspec/ci/prettify/formatter.rb', line 16

def initialize(output)
  @output = output
end

Instance Method Details

#close(_notification) ⇒ Object



59
60
61
# File 'lib/rspec/ci/prettify/formatter.rb', line 59

def close(_notification)
  @output << "\n"
end

#dump_failures(notification) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/rspec/ci/prettify/formatter.rb', line 41

def dump_failures(notification)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap('FAILURES:', :failure)
  @output << "\n\n\t"
  @output << failed_examples_output(notification)
end

#dump_pending(notification) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rspec/ci/prettify/formatter.rb', line 29

def dump_pending(notification)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap('PENDING:', :pending)
  @output << "\n\n\t"

  @output << notification.pending_examples.map do |example|
    RSpec::Core::Formatters::ConsoleCodes.wrap(format_example_summary(example), :pending)
  end.join("\n\t")
end

#dump_summary(summary) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/rspec/ci/prettify/formatter.rb', line 20

def dump_summary(summary)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap(RSpec::Ci::Prettify::Constants::SEPARATOR, :bold_white)
  @output << "\n\n"
  @output << RSpec::Core::Formatters::ConsoleCodes.wrap('SUMMARY:', :cyan)

  build_summary(summary)
end

#example_failed(notification) ⇒ Object



50
51
52
53
# File 'lib/rspec/ci/prettify/formatter.rb', line 50

def example_failed(notification)
  annotation = RSpec::Ci::Prettify::Annotation.new(notification)
  output << "\n::error file=#{annotation.file},line=#{annotation.line}::#{annotation.error}"
end

#example_passed(_example) ⇒ Object



55
# File 'lib/rspec/ci/prettify/formatter.rb', line 55

def example_passed(_example); end

#example_pending(_example) ⇒ Object



57
# File 'lib/rspec/ci/prettify/formatter.rb', line 57

def example_pending(_example); end