Created
October 23, 2011 17:21
-
-
Save skanev/1307599 to your computer and use it in GitHub Desktop.
A custom RSpec runner for vim-nexus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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