Class: YamlFormatter
- Inherits:
-
DottedFormatter
- Object
- DottedFormatter
- YamlFormatter
- Defined in:
- lib/extensions/mspec/mspec/runner/formatters/yaml.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from DottedFormatter
Instance Method Summary collapse
- #after(state) ⇒ Object
- #finish ⇒ Object
-
#initialize(out = nil) ⇒ YamlFormatter
constructor
A new instance of YamlFormatter.
- #switch ⇒ Object
Methods inherited from DottedFormatter
#abort, #before, #exception, #exception?, #failure?, #print, #print_exception, #register
Constructor Details
#initialize(out = nil) ⇒ YamlFormatter
Returns a new instance of YamlFormatter.
5 6 7 8 9 10 11 12 13 |
# File 'lib/extensions/mspec/mspec/runner/formatters/yaml.rb', line 5 def initialize(out=nil) super(nil) if out.nil? @finish = $stdout else @finish = File.open out, "w" end end |
Instance Method Details
#after(state) ⇒ Object
19 20 |
# File 'lib/extensions/mspec/mspec/runner/formatters/yaml.rb', line 19 def after(state) end |
#finish ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/extensions/mspec/mspec/runner/formatters/yaml.rb', line 22 def finish switch print "---\n" print "exceptions:\n" @exceptions.each do |exc| outcome = exc.failure? ? "FAILED" : "ERROR" str = "#{exc.description} #{outcome}\n" str << exc. << "\n" << exc.backtrace print "- ", str.inspect, "\n" end print "time: ", @timer.elapsed, "\n" print "files: ", @tally.counter.files, "\n" print "examples: ", @tally.counter.examples, "\n" print "expectations: ", @tally.counter.expectations, "\n" print "failures: ", @tally.counter.failures, "\n" print "errors: ", @tally.counter.errors, "\n" print "tagged: ", @tally.counter.tagged, "\n" end |
#switch ⇒ Object
15 16 17 |
# File 'lib/extensions/mspec/mspec/runner/formatters/yaml.rb', line 15 def switch @out = @finish end |