skalnik/vim-vroom — pull request #19 by charlietanksley (2012-07-08 19:02:59+00:00)
Title: Add custom runner

This is a revision of my previous stab at making custom runners easy. :) This fixes the issue I was having where the line number was getting set permanently and cleans up the history just a bit. So I'm happy with this version.

Here's the pull request from before. I'll add a brief note at the end with some updates.

This is a pretty serious reworking of some of the underpinnings to give some new functionality, but nothing from the outside has to change. You can see the code here, so I won't say too much about it. But here's an overview:

I rewrote the two main functions (vroom#RunTestFile() and vroom#RunNearestTest()) so that they take an optional argument, a dictionary. That dictionary can have two keys: 'runner' and 'options'. This lets me define a mapping like so:

```
nmap td :call vroom#RunTestFile({'runner':'spin serve'})
```

or, if I'd rather use Spork:

```
nmap td :call vroom#RunTestFile(('options':'--drb'})
```

You could also use a better Test::Unit runner:

```
nmap tD :call vroom#RunNearestTest(('runner':'m})
```

The rewritten functions are flexible enough to keep from changing the current api while still giving the flexibility that I wanted.

I moved a decent bit of stuff around, but I didn't mess with any of the option checking. So hopefully nothing is broken. :) I tested manually as much as I could, but I'm sure I didn't get everything.

## Update

Since I changed the internal methods a good deal, I ended up having to add the custom Rspec variable from the last merge via a merge conflict commit (well, a rebase, so you can't see it!). That should be right in this version, though I didn't test it.

## Questions:

1. One concern here is with the color flag. I don't include it in the custom runner option, since I assume you might have some runners that don't use that flag at all. But maybe it should be in there?
2. In this same branch I made some changes to the default behavior for calling tests (using `ruby`). I don't think you want to use the bundle prefix there (you definitely don't want to use your binstub prefix, else you'd call `./bin/ruby`, which won't exist), and I don't think you want to use the color flag. Maybe you want to call `bundle exec`? I don't use `bundle exec` so I don't know if this is the proper behavior or not. The question: should I leave this change in here, or was it misguided?