running a single shoulda context, ala the -n command line option

3 views
Skip to first unread message

dmeiz

unread,
May 15, 2008, 12:12:07 PM5/15/08
to shoulda
Any way to do this? Saw some Textmate-related discussion, but I'm a
vim user.

Thanks,
Dan

rwc9u

unread,
May 16, 2008, 10:26:44 AM5/16/08
to shoulda
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
Reply all
Reply to author
Forward
0 new messages