Spork alternative compatible with cucumber

1 minute read

Version 1.3.0 of Cucumber droped spork support, so I had to find something else. I am using Guard setup with rspec and Cucumber for my Rails app.

I first tried Zeus with guard-zeus, it kind of worked, but it ruined my Guard console with the Zeus server status, and it left zombie processes on guard exit …

Eventually, I tried Spring, and once I made sure rspec and cucumber both ran on the test environment, it worked fine with minimal configuration. Here is what I had to do to get it working

  • remove spork from your Gemfile
  • remove require ‘spork’, Spork.prefork and Spork.each_run calls from spec/spec_helper.rb and features/support/env.rb
  • install spring
gem install spring
group :test, :development do
  ...
  gem 'spring'
  ...
group
  • update your Guardfile example :
guard :rspec, cli: "--tag ~@slow", all_after_pass: true, all_on_start: false, keep_failed: true, spring: true, bundler: false do
  ...
end


guard 'cucumber', all_on_start: false, cli: '--format progress --no-profile', command_prefix: 'spring', bundler: false do
  ...
end
  • add a .spring.rb file to automaticaly restart Spring on main file changes. I think I’ll have to update this file when I discover that a test failed because spring needs to be restarted
Spring.watch ".spring.rb"
Spring.watch "spec/factories"
Spring.watch "features/env.rb"

Spring.watch_method = :listen

I usually write about 15 minutes worth of reading per month. I won't transfer your email. No Spam, unsubscribe whenever you want.

As a gift for subscribing, you'll receive an illustrated mini-ebook "How to start a team coding dojo"!

Leave a comment