views:

41

answers:

2

Hi. I'm trying to speed up "rspecing" in a rails 2.3.8 app with spork. When I run spork in the root of the project I get:

(...stuff...)
No server is running
Running specs locally:
Spork is ready and listening on 8989!

And then, if I run specs, the message

 No server is running 
 Running specs locally 

which appears if I run them without Spork doesn't appear, however spec startup is as slow as without Spork. Also in Spork's terminal no further output appears.

My question is, is spork actually running? If so, are the specs running there?, and finally, if the answer to both is true, how can I speed up my tests?

Here are the config files involved:

spec/spec.opts

  --colour
  --format progress
  --loadby mtime
  --reverse
  --drb

spec/spec.helper

require 'rubygems'
require 'bundler/setup'
require 'spork'


Spork.prefork do

   ENV["RAILS_ENV"] ||= 'test'
   require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
   require 'spec/autorun'
   require 'spec/rails'

   Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}

   Spec::Runner.configure do |config|
  end


 end

 Spork.each_run do

end

And, to have a full question, here are the times measured with 'time':

With Spork:

real    0m39.524s
user    0m5.012s
sys  0m0.912s

Without Spork:

real    0m39.576s
user    0m18.537s
sys  0m2.400s

When running sport --diagnose I get

 - Spork Diagnosis -
 -- Summary --
 config/boot.rb
 config/initializers/inflections.rb
 config/initializers/mime_types.rb
 config/initializers/new_rails_defaults.rb
 config/initializers/site_keys.rb
 config/preinitializer.rb
 spec/spec_helper.rb

And then, for

 --- config/initializers/inflections.rb ---
 --- config/initializers/mime_types.rb ---
 --- config/initializers/new_rails_defaults.rb ---
 --- config/initializers/site_keys.rb ---

The following stacktrace

 /var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:147:in `load'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:622:in `load_application_initializers'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `each'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `load_application_initializers'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:176:in `process'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
 /var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run_without_spork'
 /var/lib/gems/1.8/gems/spork-0.8.4/lib/spork/app_framework/rails.rb:18:in `run'
 config/environment.rb:15
 spec/spec_helper.rb:14:in `require'
 spec/spec_helper.rb:14
 /var/lib/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:23:in `prefork'

spec/spec_helper.rb:6

A: 

The actions needed to enable spork are as follows :-

  1. add --drb to spec/spec.opts to tell spec to use drb to communicate with spork.
  2. Bootstrap spork using spork --bootstrap
  3. Modify spec/spec_helper.rb to setup spork

Have you done all of these three steps?

More information is available here

Steve Weet
Yes I have, updated the question with the contents of those files
diegogs
A: 

Your setup looks good to me. The lack of output is normal.

Did you try spork --diagnose? It should spit out a list of all the files spork preloads.

zetetic
Will try on monday and report back any findings :)
diegogs
Updated the question
diegogs
To confirm, you get the "No server is running" message without spork, and no message when spork *is* running, correct?
zetetic