Class: Specifier::Formatter::Documentation
- Defined in:
- lib/specifier/formatter/documentation.rb
Overview
Constant Summary collapse
- INDENTATION =
' '.freeze
- NAME =
'documentation'.freeze
- PASS =
'[PASS]'.freeze
- FAIL =
'[FAIL]'.freeze
Instance Method Summary collapse
- #context(context) ⇒ Object
-
#initialize(logger) ⇒ Documentation
constructor
A new instance of Documentation.
- #record(example, result) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(logger) ⇒ Documentation
Returns a new instance of Documentation.
22 23 24 25 |
# File 'lib/specifier/formatter/documentation.rb', line 22 def initialize(logger) super @indentation = 0 end |
Instance Method Details
#context(context) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/specifier/formatter/documentation.rb', line 39 def context(context) @logger.log(indent(context.description)) @indentation = @indentation.next super @indentation = @indentation.pred end |
#record(example, result) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/specifier/formatter/documentation.rb', line 27 def record(example, result) super = case result.status when :pass then Colorizer.passed(indent("#{PASS} #{example.description}")) when :fail then Colorizer.failed(indent("#{FAIL} #{example.description}")) end @logger.log() end |