Code Monkey home page Code Monkey logo

vim-rubytest's Introduction

Rubytest.vim
============

Rubytest.vim is a vim (http://www.vim.org) plugin, which helps you to run ruby test (including vanilla test, rspec, shoulda etc.) in vim.

Installation
------------

Copy all files to your ~/.vim directory.

Usage
-----

After installation, press <Leader>t will run the test under your cursor if you are editing a ruby test file.

example:

$ cd <your rails/merb root>
$ vim test/unit/user_test.rb
(move cursor into a test case, press <Leader>t)

(<Leader> is mapping to '\' by default in vim)

By default, only test errors will be shown to you. If some of your tests failed, the errors will be displayed in vim's quickfix window, and you can quick jump to the place where the error raise in source file by moving cursor onto the error message and press return (or ctrl-w return to open a new window and jump). If you don't want quickfix, just want to run tests and get results you can set g:rubytest_in_quickfix to 0 in your .vimrc file:

  let g:rubytest_in_quickfix = 0

You can customize the command which will be used to run the test case by settting these options in your vimrc file:

  let g:rubytest_cmd_test = "ruby %p"
  let g:rubytest_cmd_testcase = "ruby %p -n '/%c/'"
  let g:rubytest_cmd_spec = "spec -f specdoc %p"
  let g:rubytest_cmd_example = "spec -f specdoc %p -e '%c'"
  let g:rubytest_cmd_feature = "cucumber %p"
  let g:rubytest_cmd_story = "cucumber %p -n '%c'"

(%p will be replaced by the path of test file, %c will be replaced by the name of test case under cursor)

Default Key Bindings
--------------------

<Leader>t: run test case under cursor
<Leader>T: run all tests in file
<Leader>l: run the last test, from any buffer

You can change default key bindings:

  map <Leader>\ <Plug>RubyTestRun " change from <Leader>t to <Leader>\
  map <Leader>] <Plug>RubyFileRun " change from <Leader>T to <Leader>]
  map <Leader>/ <Plug>RubyFileRun " change from <Leader>l to <Leader>/

vim-rubytest's People

Contributors

bogdan avatar jweir avatar nowk avatar

Stargazers

Srushti Ambekallu avatar

Watchers

Srushti Ambekallu avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.