Spork Alternative Compatible With Cucumber

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
1
gem install spring
1
2
3
4
5
group :test, :development do
  ...
  gem 'spring'
  ...
group
  • update your Guardfile example :
1
2
3
4
5
6
7
8
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
1
2
3
4
5
Spring.watch ".spring.rb"
Spring.watch "spec/factories"
Spring.watch "features/env.rb"

Spring.watch_method = :listen

Comments