Vladimir Sarić wrote this on October 5, 2011

Streamlining vim with RSpec and Cucumber

Few months back I was looking at ways to better our BDD workflow.

I stumbled upon this gist by @heisters and it got my attention right away. Basically, what it does is it lets you run your specs/scenarios directly from vim. It supports running the whole file or just the spec/scenario under your cursor. Of course the cursor doesn’t have to be directly on your spec’s description/context/it method calls, just within their body. The same goes for scenarios, no need to point your cursor over the scenario title, it’s enough for the cursor to be within it’s body.

I forked it to do some customization. I removed support for script files(script/spec and script/cucumber) and added Spork support.

Currently pressing Space-; will run the spec/scenario under your cursor and pressing Space-' will run the whole spec/feature file.

The nice part is that, if you are using Spork in your application and the Spork server is running, it will run the specs/scenarios through it, if not, it will just run without it, without any extra work on your part.

Installation is really simple, just put the file (don’t forget the .vim extension) in your vim’s plugin directory.

And remember you can always modify the keybinds to your liking. RunTest function will run a specific spec/scenario and the RunTestFile function will run the whole spec/feature file.

Feel free to comment and share your tips and tricks.

comments powered by Disqus


Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.

Contact

Rendered Text is a software company. For questions regarding Semaphore, please visit semaphoreci.com. Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad
Serbia