class RspecEditor::Rspec2::Formatter
Attributes
editor[R]
Public Class Methods
new(*args, &blk)
click to toggle source
Calls superclass method
# File lib/rspec_editor/rspec2/formatter.rb, line 6 def initialize *args, &blk @editor = Editor.new @editor.check_enabled! super end
Public Instance Methods
start_dump()
click to toggle source
Calls superclass method
# File lib/rspec_editor/rspec2/formatter.rb, line 12 def start_dump result = super if editor.enabled? begin editor.open process_examples! result ensure editor.close end end result end
Private Instance Methods
process_examples!()
click to toggle source
# File lib/rspec_editor/rspec2/formatter.rb, line 30 def process_examples! failed_examples.each do | example | write_example! example, editor end end
write_example!(example, editor)
click to toggle source
# File lib/rspec_editor/rspec2/formatter.rb, line 36 def write_example! example, editor location = example.location # location = File.expand_path(location) editor.puts "#{location}: # #{example.full_description}" exc = example.execution_result[:exception] exc_desc = exc.inspect.gsub(/\n/, ' ') editor.puts "#{location}: # #{exc_desc}" i = 0 format_backtrace(exc.backtrace, example).each do |backtrace_info| # backtrace_info = File.expand_path(backtrace_info) editor.puts "%70s # %d" % [ backtrace_info.to_s, i += 1 ] end editor.puts "" end