ruby on rails - How to know if Spork is running -
i'm trying speed "rspecing" in rails 2.3.8 app spork. when run spork in root of project get:
(...stuff...) no server running running specs locally: spork ready , listening on 8989!
and then, if run specs, message
no server running running specs locally
which appears if run them without spork doesn't appear, spec startup slow without spork. in spork's terminal no further output appears.
my question is, spork running? if so, specs running there?, , finally, if answer both true, how can speed tests?
here 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 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 |config| end end spork.each_run end
and, have full question, here times measured '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 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,
--- 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
i ran same problem, , able figure out.
around line 50 of lib/tasks/rspec.rake find following line.
spec_prereq = file.exist?(file.join(rails_root, 'config', 'database.yml')) ? "db:test:prepare" : :noop
this causing db:test:prepare run before specs, in turn loads environment, defeating whole purpose of spork. commented out line , added following below it.
spec_prereq = :noop
this change should result in quite bit of improvement. have run db:test:prepare manually after run db:migrate. have command both.
i don't know whether you're using bundler, saw additional speed gains upgrading latest (1.0.7). (bundler sets load paths when rake loaded in 2.3.x)
i still have ~2.5s delay resulting overhead of spork, rake, , bundler, hope can improved in future, perhaps when spork supports rails 3.
Comments
Post a Comment