Integrating Minitest with Shippable

I know, everyone uses Travis. I have nothing against it. But in case you want to test and/or use Shippable, this might be just the guide for you. I will also show how to setup that nice tabs with the test and coverage reports.


I’m writing this post because I found no blog post or anything compiling all the needed steps, just some parts here and there. I want to make it easy for new users to start testing their stuff using an Continuous Integration system.

So, this is my attempt to compile all that in a how-to like blog post.

The good stuff

First thing we need is the .shippable.yml file. Mine looks like this:

language: ruby
  - 2.1.2
  - bundle exec rake test
    - CI_REPORTS=shippable/testresults COVERAGE_REPORTS=shippable/codecoverage

The env is required for that nice tabs I said before to work.

Don’t forget to add the required stuff to Gemfile:

source ""
gem "rake" # make sure you have rake here!
# ...
group :development, :test do
  gem "minitest"
  gem "simplecov"
  gem "simplecov-csv"
  gem "minitest-reporters"

I also created a Rakefile (so I can call it in the .shippable.yml file):

require 'rake/testtask' do |t|
  t.pattern = "spec/*_spec.rb"

The last thing we need is the spec/spec_helper.rb file:

require "simplecov"
require "simplecov-csv"
SimpleCov.formatters = [
SimpleCov.start # you might want to pass 'rails' and/or a block here
require "minitest/autorun"
require "minitest/reporters"
    ENV["CI_REPORTS"] || "coverage/ci"
require_relative "../lib/mylibrary" # change to your library here

Most of this stuff is for Shippable to correctly parse test and coverage results. The order of the stuff here does matter. Don’t change it if you don’t know what you’re doing.

With that being said, now, our specs will just have to require our spec_helper, and everything should work like magic when you run bundle exec rake test.


I had some trouble with compatibility issues related to Ruby’s minitest. To clarify: there is the minitest gem and the minitest inside Ruby itself. If you use RVM (Shippable does), you will find it under ~/.rvm/rubies/ruby-VERSION/lib/ruby/2.1.0/minitest/.

Unfortunately for me, I use rbenv, and, for some reason I don’t yet understand, rake test worked beautifully. With Shippable and RVM, I got this:

/home/shippable/.rvm/gems/ruby-2.1.2/gems/minitest-5.5.1/lib/minitest/assertions.rb:17: warning: already initialized constant MiniTest::Assertions::UNDEFINED
/home/shippable/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/minitest/unit.rb:80: warning: previous definition of UNDEFINED was here
Emptying /home/shippable/workspace/src/

To fix that, I just had to change the rake test to bundle exec rake test (as already demonstrated in the .shippable.yml file in the beginning of this post). Simple fix for a hard-to-understand problem.

Related Posts

Improving Jekyll build time

70% cheaper Kubernetes cluster on AWS

Writing cli applications with Golang