Trying out Spin as an alternative to Spork

Even after applying the suggested changes to have Simplecov work nicely with Spork, I wasn’t fully satisfied because coverage report was still not accurate 100% of the time.So I tried Spin to see how it worked and it has been great.

The advantage over Spork is that the application does not need to be modified. Just install the Spin gem, launch the spin server (spin serve –push-results), and in other terminal launch tests when needed (spin push rspec).

The first caveat: no cukes

No cucumber support out of the box. I found a fork by Ricky Robinson that offers cucumber support and works just great. It also enables by default unit/rspec/cucumber testing, so you no longer have to switch processes to execute each type of tests. You can read more on his blog post.

The second caveat: no merge coverage results

I think this is due to the fact that instead of launching directly rspec (or cucumber) you are launching spin and this tags the results as “spin”. Each time spin push XX is launched, “spin” coverage results are overwritten.  I extrapolated from this issue that I could try the same approach and it works just fine:

# at the top of spec/spec_helper.rb
require 'simplecov'
SimpleCov.start 'rails' do
  command_name 'rspec'


# at the top of features/support/env.rb
require 'simplecov'
SimpleCov.start 'rails' do
  command_name 'cukes'

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s