vim-spectator


Ⅰ. 插件描述

spectator.vim: Generate rspec files for code

Ⅱ. 基本信息

创建日期:  2013-12-28
使用用户:  1
Github星:  1
插件作者:  Tomáš Kramár

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'kremso/vim-spectator'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'kremso/vim-spectator'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'kremso/vim-spectator'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/kremso/vim-spectator

Ⅳ. 文档说明

# spectator.vim

vim-rails provides :A command that alternates between code and tests. Unfortunately, it only works if the alternate file exists and this is not likely to change.

spectator.vim complements rails.vim and overrides its :A command. If the alternate file exists, the behavior is the same as with rails.vim. If the alternate file does not exist, it is created and populated with skeleton code. Let's see.

Start with a new file, say lib/search/es/mapper.rb. press :A and spectator.vim will create the corresponding spec file in spec/lib/search/es/mapper_spec.rb and populate it with

require 'search/es/mapper'

module Search::Es
  describe Mapper do
    it '' do
    end
  end
end

Notice that spectator.vim detects modules and requires the spec'd file. It is also smart enough to handle files in app. When you are in app/controllers/api/v2/fields_controller.rb and press :A, spectator.vim creates new spec in spec/controllers/api/v2/fields_controller_spec.rb and populates it with

require 'spec_helper'

module Api::V2
  describe FieldsController do
    it '' do
    end
  end
end

Limitations

  • Only handles rspec

添加新评论