Class: XSpec::Notifier::ColoredDocumentation
- Inherits:
-
Object
- Object
- XSpec::Notifier::ColoredDocumentation
- Includes:
- Composable, EmptyFormatter, ShortIdSupport
- Defined in:
- lib/xspec/notifiers.rb
Overview
Includes nicely formatted names and durations of each test in the output, with color.
Direct Known Subclasses
Constant Summary collapse
- VT100_COLORS =
{ :black => 30, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :white => 37 }
Instance Method Summary collapse
- #evaluate_finish(result) ⇒ Object
-
#initialize(out = $stdout) ⇒ ColoredDocumentation
constructor
A new instance of ColoredDocumentation.
- #run_finish ⇒ Object
Methods included from ShortIdSupport
Methods included from Composable
Methods included from EmptyFormatter
Constructor Details
#initialize(out = $stdout) ⇒ ColoredDocumentation
Returns a new instance of ColoredDocumentation.
235 236 237 238 239 240 |
# File 'lib/xspec/notifiers.rb', line 235 def initialize(out = $stdout) self.indent = 2 self.last_seen_names = [] self.failed = false self.out = out end |
Instance Method Details
#evaluate_finish(result) ⇒ Object
242 243 244 245 246 247 248 249 250 |
# File 'lib/xspec/notifiers.rb', line 242 def evaluate_finish(result) output_context_header! result.parents.map(&:name).compact spaces = ' ' * (last_seen_names.size * indent) self.failed ||= result.errors.any? out.puts "%s%s" % [spaces, decorate(result)] end |
#run_finish ⇒ Object
252 253 254 255 |
# File 'lib/xspec/notifiers.rb', line 252 def run_finish out.puts !failed end |