Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

guard-spork

> 编程语言
Open source

Guard::Spork automatically manage Spork DRb servers

293 stars0 likes4 views
WebsiteGitHub

About

Guard::Spork automatically manage Spork DRb servers

Guard::Spork

Guard::Spork allows to automatically & intelligently start/reload your RSpec/Cucumber/Test::Unit Spork server(s).

  • Compatible with Spork 0.8.4 & 0.9.0.rcX.
  • Tested against Ruby 1.9.3, 2.0.0, 2.1.2, and JRuby.

Install

Please be sure to have Guard installed before continuing.

Install the gem:

$ gem install guard-spork

Add it to your Gemfile (inside development group):

ruby
group :development do
  gem 'guard-spork'
end

Add guard definition to your Guardfile with:

$ guard init spork

Usage

Please read the Guard usage documentation.

Guardfile

Please read Guard doc for more info about the Guardfile DSL.

IMPORTANT: place Spork guard before RSpec/Cucumber/Test::Unit guards!

Rails app

ruby
guard 'spork' do
  watch('config/application.rb')
  watch('config/environment.rb')
  watch(%r{^config/environments/.*\.rb$})
  watch(%r{^config/initializers/.*\.rb$})
  watch('Gemfile.lock')
  watch('spec/spec_helper.rb') { :rspec }
  watch('test/test_helper.rb') { :test_unit }
  watch(%r{features/support/}) { :cucumber }
end

Running specs over Spork

Pass the :cmd => "rspec --drb" option to Guard::RSpec and/or Guard::Cucumber to run them over the Spork DRb server:

ruby
guard 'rspec', :cmd => "rspec --drb" do
  # ...
end

guard 'cucumber', :cmd => "rspec --drb" do
  # ...
end

For MiniTest Guard you should pass the :drb => true option:

ruby
guard 'minitest', :drb => true do
  # ...
end

Options

Guard::Spork automatically detect RSpec/Cucumber/Test::Unit/Bundler presence but you can disable any of them with the corresponding options:

ruby
guard 'spork', :rspec => false, :cucumber => false, :test_unit => false, :bundler => false do
  # ...
end

You can provide additional environment variables for RSpec, Cucumber, and Test::Unit with the :rspec_env, :cucumber_env, and :test_unit_env options:

ruby
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'cucumber' }, :rspec_env => { 'RAILS_ENV' => 'test' }, :test_unit_env => { 'RAILS_ENV' => 'test' } do
  # ...
end

If your application runs on Heroku or otherwise uses Foreman, you can provide the :foreman => true option to have environment variables present in the .env file passed on to the Spork server.

Available options:

…

Common troubleshooting

If you can start Spork manually but get the following error message when using Guard::Spork:

Starting Spork for RSpec ERROR: Could not start Spork for RSpec/Cucumber. Make sure you can use it manually first.

Try to increase the value of the :wait => 60 option before any further investigation. It's possible that this error is the result of an unnecessary /test directory in the root of your application. Removing the /test directory entirely may resolve this error.

Development

  • Source hosted at GitHub.
  • Report issues and feature requests to GitHub Issues.

Pull requests are very welcome! Please try to follow these simple "rules", though:

  • Please create a topic branch for every separate change you make.
  • Make sure your patches are well tested.
  • Update the README (if applicable).
  • Please do not change the version number.

For questions please join us on our Google group or on #guard (irc.freenode.net).

Author

Thibaud Guillaume-Gentil

Issues· 7 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言