[rspec-users] Rspec Rails high overhead

Mark Wilden mark at mwilden.com
Sat Jan 3 23:17:12 EST 2009

On Sat, Jan 3, 2009 at 6:58 PM, Reza Primardiansyah <
reza.primardiansyah at gmail.com> wrote:

> I found out that running RSpec on Rails takes too much overhead. It takes
> more than 16s per run although the specs only take less than 6s, like seen
> below.

The killer is the time it takes to load environment.rb, which loads Rails,
runs initializers, etc. The rake spec task also tears down and recreates the
test database, but that's not as significant.

The solution to the first situation is spec_server, which loads the
environment once, then stays in memory as a DRb process. By passing --drb to
the spec command, RSpec will have that process run specs. The solution to
the second situation is to not run rake spec, but instead use spec or

All that said, I haven't had as much joy from spec_server as I have in the
past. Too often it seems to not load changed models. But this might be
related to a patch I had to apply to even get it to run. Things seemed to
have changed with Rails 2.2.2 and/or RSpec 1.1.11.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090103/c272ecff/attachment.html>

More information about the rspec-users mailing list