Module: Bacon::PrettyOutput
- Included in:
- Bacon
- Defined in:
- lib/ramaze/spec/helper/pretty_output.rb,
lib/ramaze/spec/helper/pretty_output.rb
Constant Summary collapse
- NAME =
''
- RamazeLogger =
Ramaze::SpecLogger.new
Instance Method Summary collapse
-
#general_error ⇒ Object
Show nicer output on error.
-
#handle_requirement(description) ⇒ Object
Core, yields the requirement and outputs problems.
-
#handle_specification(name) ⇒ Object
store name and run.
-
#handle_summary ⇒ Object
output summary.
Instance Method Details
#general_error ⇒ Object
Show nicer output on error
35 36 37 38 39 40 41 |
# File 'lib/ramaze/spec/helper/pretty_output.rb', line 35 def general_error puts "", ErrorLog ErrorLog.scan(/^\s*(.*?):(\d+): #{NAME} - (.*?)$/) do puts "#{ENV['EDITOR'] || 'vim'} #$1 +#$2 # #$3" end ErrorLog.replace '' end |
#handle_requirement(description) ⇒ Object
Core, yields the requirement and outputs problems
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ramaze/spec/helper/pretty_output.rb', line 14 def handle_requirement(description) print "- #{description}\n" error = yield unless error.empty? if defined?(Ramaze::Logging) puts '', " #{NAME} -- #{description} [FAILED]".center(70, '-'), '' colors = Ramaze::Logger::Informer::COLORS until RamazeLogger.history.empty? tag, line = RamazeLogger.history.shift out = "%6s | %s" % [tag.to_s, line] puts out.send(colors[tag]) end end general_error end end |
#handle_specification(name) ⇒ Object
store name and run
6 7 8 9 10 11 |
# File 'lib/ramaze/spec/helper/pretty_output.rb', line 6 def handle_specification(name) NAME.replace name puts NAME yield puts end |
#handle_summary ⇒ Object
output summary
44 45 46 47 48 |
# File 'lib/ramaze/spec/helper/pretty_output.rb', line 44 def handle_summary puts puts "%d tests, %d assertions, %d failures, %d errors" % Counter.values_at(:specifications, :requirements, :failed, :errors) end |