Skip to content

Instantly share code, notes, and snippets.

@skanev
Created October 23, 2011 17:21
Show Gist options
  • Select an option

  • Save skanev/1307599 to your computer and use it in GitHub Desktop.

Select an option

Save skanev/1307599 to your computer and use it in GitHub Desktop.
A custom RSpec runner for vim-nexus
require 'rspec/core/formatters/base_formatter'
require 'tempfile'
class NexusFormatter < RSpec::Core::Formatters::BaseFormatter
def initialize(output)
super
@file = Tempfile.new('nexus-output')
end
def stop
failed_examples.each_with_index do |example, index|
exception = example.execution_result[:exception]
backtrace = format_backtrace(exception.backtrace, example)
say "" unless index.zero?
say "(#{index + 1}) #{example.full_description}"
say " #{exception.class.name}: #{exception.message}"
backtrace.each { |line| say line }
end
@file.close
system %{mvim --remote-expr "NexusLoadQuickfix('#{@file.path}')"}
end
private
def say(line)
@file.puts line
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment