Alternative ways to skip tests in Minitest
Switch branches/tags
Nothing to show
Clone or download
Ivan Tse
Latest commit 2c47e8e Feb 1, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/minitest Add skip macro Feb 1, 2016
test Add skip macro Feb 1, 2016
.gitignore First commit Jan 23, 2016
Gemfile First commit Jan 23, 2016
LICENSE.txt First commit Jan 23, 2016 Add skip macro to readme Feb 1, 2016
Rakefile Add rake test task and make test less strict Jan 23, 2016
minitest-skip.gemspec First commit Jan 23, 2016

Minitest Skip

This gem provides alternative ways of skipping a test. Normally a skipped test in Minitest looks like:

def test_that_is_flaky
  skip "Figure out why this flakes"

The gotcha for skipping tests with the skip keyword is that the setup and teardown blocks are still executed. This can be costly for acceptance tests since their setup usually involves starting a browser among other slow things.

This gem will allow you to use methods that begin with skip_ to mark a test as skipped. It modifies Minitest such that it will recognize these skip methods and correctly report the results.

require "minitest/autorun"
class TestSkip < Minitest::Test
  def setup
    sleep 2 # costly setup block

  def skip_test_that_is_temporarily_broken
    # ...

# ruby test/test_skip.rb
# Run options: --seed 54134

# # Running:

# S

# Finished in 0.001663s, 601.3537 runs/s, 0.0000 assertions/s.

# 1 runs, 0 assertions, 0 failures, 0 errors, 1 skips

# You have skipped tests. Run with --verbose for details.

This gem also adds xit and xdescribe if you prefer the spec style syntax for Minitest.

require "minitest/autorun"
require "minitest/spec"
require "minitest/skip_dsl"

describe "Test" do
  it "normal" do assert true end
  xit "skipped" do assert false end
  xdescribe "All skipped" do
    it "nested skip" do assert false end

Or you can use the skip macro (suggested by @sgtFloyd):

skip def test_something
  # ...


Add this line to your application's Gemfile:

gem 'minitest-skip'

And then execute:

$ bundle

Or install it yourself as:

$ gem install minitest-skip

And that's it! This is a Minitest plugin which means that it will be autoloaded. If you want to use xit and xdescribe methods, you also need to require "minitest/skip_dsl".


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request