# Rubytest.vim 0.9.0

**URL:** <https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897>\
**Category:** Ruby\
**Created:** [April 19, 2009, 11:45am UTC](https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897 "2009-04-19T11:45:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flowerborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/d9b06d/32.png) [@flowerborn](https://www.ruby-forum.com/u/flowerborn)\
**Post date:** [April 19, 2009, 11:45am UTC](https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897/1 "2009-04-19T11:45:40Z")

</div>

Hi list,

I’m pleased to announce the first release of rubytest, which is a  
vim plugin aims to help you run ruby test (including vanilla test,  
rspec, shoulda etc.) conveniently.

[http://www.vim.org/scripts/script.php?script\_id=2612](http://www.vim.org/scripts/script.php?script_id=2612)

## Installation

Copy all files to your ~/.vim directory.

## Usage

After installation, hit 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 t)

( is mapping to '' by default in vim)

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’”

## Default Key Bindings

t: run test case under cursor  
T: run all tests in file

I’ve only tested with tests in rails/merb project. Looking forward to  
receiving your feedback.

Thanks,  
Jan

---

<div class="post-metadata">

**Author:** ![flowerborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/d9b06d/32.png) [@flowerborn](https://www.ruby-forum.com/u/flowerborn)\
**Post date:** [April 20, 2009, 1:13am UTC](https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897/2 "2009-04-20T01:13:56Z")

</div>

On Sun, Apr 19, 2009 at 2:44 AM, Jan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> $ cd \<your rails/merb root\>  
> let g:rubytest\_cmd\_spec = “spec -f specdoc %p”
> 
> Thanks,  
> Jan
> 
> –  
> jan=callcc{|jan|jan};jan.call(jan)

This plugin works great for me. In the version copied into my  
plugins, I changed the individual test to \ so I could double  
tap \ to run the test under the cursor. And ] to run all  
tests since ] is next to \ on my keyboard and quicker to type than  
T

Thanks  
Mike

---

<div class="post-metadata">

**Author:** ![flowerborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/d9b06d/32.png) [@flowerborn](https://www.ruby-forum.com/u/flowerborn)\
**Post date:** [April 20, 2009, 2:39am UTC](https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897/3 "2009-04-20T02:39:55Z")

</div>

- Mike M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2009-04-20 08:13:22 +0900]:

> This plugin works great for me. In the version copied into my  
> plugins, I changed the individual test to \ so I could double  
> tap \ to run the test under the cursor. And ] to run all  
> tests since ] is next to \ on my keyboard and quicker to type than  
> T
> 
> Thanks  
> Mike

You can customize the key bindings in your .vimrc instead of modifying  
the plugin (if I understand correctly 🙂

map \ RubyTestRun  
map ] RubyFileRun

Cheers,  
Jan

---

<div class="post-metadata">

**Author:** ![flowerborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/d9b06d/32.png) [@flowerborn](https://www.ruby-forum.com/u/flowerborn)\
**Post date:** [April 20, 2009, 3:40am UTC](https://www.ruby-forum.com/t/rubytest-vim-0-9-0/165897/4 "2009-04-20T03:40:44Z")

</div>

On Sun, Apr 19, 2009 at 5:38 PM, Jan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> jan=callcc{|jan|jan};jan.call(jan)

That’s even better, thanks for the tip.  
Mike
