I don't have a solution for you in vim, but I just added this support
in emacs and you can probably base it off of however you run tests for
a regular TestUnit test. In the case of shoulda contexts I do the
following:
I take the location of my cursor (point) and move to the end of the
current ruby block. I then do a regular expression search backwards
from that location for the context line and capture the string:
(search-backward-regexp "^[ ]*context \"\\([a-z0-9_ ]+\\)\"[ ]*do" nil
t)
Next, I manipulate the context name into a regular expression similar
to what is done in the Textmate bundle (which I based my changes on).
Then you can run the current file and pass --name=/your regular
expression/
You can see the code within my emacs-rails mode fork. Look at rails-
shoulda.el
git clone git://
github.com/rwc9u/emacs-rails.git
Rob