class RspecEditor::Rspec3::Formatter
Attributes
editor[R]
failed_examples[R]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/rspec_editor/rspec3/formatter.rb, line 8 def initialize *args super(nil) @editor = Editor.new @editor.check_enabled! end
Public Instance Methods
close(*args)
click to toggle source
# File lib/rspec_editor/rspec3/formatter.rb, line 47 def close *args editor.close end
example_failed(failure)
click to toggle source
# File lib/rspec_editor/rspec3/formatter.rb, line 21 def example_failed failure return unless @editor.enabled? @editor.open example = failure.example # location = File.expand_path(location) location = example.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 exc.backtrace.each do | bt | bt = bt.to_s next if bt =~ %r{/lib/rspec/core/} break if bt =~ %r{/(?:bin|exe)/rspec:} # next if bt =~ %r{/bin/rspec:} # backtrace_info = File.expand_path(backtrace_info) editor.puts "%70s # %d" % [ bt, i += 1 ] end editor.puts "" end
open(*args)
click to toggle source
# File lib/rspec_editor/rspec3/formatter.rb, line 15 def open *args if @editor.enabled? @editor.open end end