[rspec-users] best way to modify spec (the command-line tool)?
ben at benmabey.com
Fri Jan 4 11:14:58 EST 2008
On rspec's specs I have noticed they have a profiling flag that they
pass into the spec command. What is does is print out the longest specs
with there times. So you may not have to rewrite this.. I have tried
using the flag on my own projects but it didn't work. Maybe someone
from the dev team could enlighten us on how to use that nifty trick?
Giles Bowkett wrote:
> Hi all, where I work we've cooked up a kind of ghetto profiler for our
> specs. It basically just does this:
> time = Time.now
> # run the spec
> puts "woah! dude. long spec." if time > 1.second
> I'm simplifying here. I think the threshold is actually 0.1 seconds,
> and we use more precise language, and highlight the spec in red via
> terminal colors, etc.
> But the way it works is a bit ghetto. We just manually hacked it onto
> the Rails example groups (it's a Rails project) and then added a shell
> env var to turn it on and off.
> What's the cleanest way to implement this? Add a -profiling
> command-line flag to spec itself? Is there a single point of entry and
> exit for running individual specs that I can put the code around? It's
> currently manually hacked onto each example group individually and it
> seems a bit untidy.
More information about the rspec-users