Better formatting for epp doc

This commit is contained in:
Martin Lensment 2014-12-09 16:07:58 +02:00
parent d95224cf9c
commit c7812c5dd3
3 changed files with 5312 additions and 13 deletions

View file

@ -1,22 +1,36 @@
class EppDoc
RSpec::Core::Formatters.register self, :example_started, :example_passed, :example_failed
RSpec::Core::Formatters.register self, :start, :example_started, :example_passed, :example_failed
def initialize(output)
@output = output
end
def example_started(notification)
desc = notification.example.full_description
@output.puts '-' * desc.length
@output.puts desc
@output.puts '-' * desc.length
@output.puts '-' * 100
@output.puts notification.example.full_description
@output.puts '-' * 100
end
def start(example_count)
@output.puts '-' * 100
@output.puts 'EPP REQUEST - RESPONSE DOCUMENTATION'
@output.puts "GENERATED AT: #{Time.now}"
@output.puts "EXAMPLE COUNT: #{example_count.count}"
end
def example_passed(_example)
@output << "\n\n"
dash = '-' * 48
@output.puts "#{dash}PASS#{dash}\n\n"
end
def example_failed(_example)
@output << "\n\n"
dash = '-' * 48
@output.puts "#{dash}FAIL#{dash}\n\n"
end
def example_pending(_example)
dash_1 = '-' * 47
dash_2 = '-' * 46
@output.puts "#{dash_1}PENDING#{dash_2}\n\n"
end
end