[rspec-users] specs run faster separately than together

Jeremy Lightsmith jeremy.lightsmith at gmail.com
Wed Jan 28 16:05:32 EST 2009

On Wed, Jan 28, 2009 at 12:34 PM, Scott Taylor <scott at railsnewbie.com>wrote:

> On Jan 28, 2009, at 3:21 PM, Jeremy Lightsmith wrote:
>  So this is weird.
>> on my current project I've been working on speeding up specs, and I just
>> found that
>> time rake spec => 4m 0s
>> whereas
>> time rake spec:controllers spec:models spec:helpers spec:lib => 2m 32s
> Do those rake tasks run rake db:test:prepare, and other dependencies of
> rake spec?
> How are you getting those numbers?
> Scott

Each of those rake tasks are the default generated ones :

    Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
      t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
      t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]

So, yes db:test:prepare is a prereq for each of those, which means in both
cases it gets run exactly once.

As for those numbers, I'm using the time command, I actually run "time rake
spec" and after the spec it gives me something that looks like :

  real    4m16.242s
  user    3m54.037s
  sys     0m9.008s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090128/af2ea57d/attachment-0001.html>

More information about the rspec-users mailing list