LinuxCommandLibrary

minitest

TLDR

Run all tests

$ ruby -Ilib:test [test/test_*.rb]
copy
Run specific test file
$ ruby -Ilib:test [test/test_example.rb]
copy
Run tests with verbose output
$ ruby -Ilib:test [test/test_example.rb] --verbose
copy
Run specific test method
$ ruby -Ilib:test [test/test_example.rb] --name [test_method_name]
copy
Run with pattern
$ ruby -Ilib:test [test/test_example.rb] --name /[pattern]/
copy

SYNOPSIS

ruby -Ilib:test testfile [options_]

DESCRIPTION

Minitest is a testing framework for Ruby that provides a complete suite of testing facilities. It includes unit tests, specs, mocking, and benchmarking.
Minitest is bundled with Ruby and is known for being fast and simple.

PARAMETERS

--verbose

Verbose output.
--name pattern
Run matching tests.
--seed n
Random seed.
--pride
Rainbow output.

TEST EXAMPLE

$ require 'minitest/autorun'

class TestExample < Minitest::Test
  def setup
    @value = 1
  end

  def test_addition
    assert_equal 2, @value + 1
  end
end
copy

SPEC SYNTAX

$ describe Example do
  it "works" do
    _(1 + 1).must_equal 2
  end
end
copy

CAVEATS

Bundled with Ruby since 1.9. Tests run in random order by default. Fewer features than RSpec but faster.

HISTORY

Minitest was created by Ryan Davis (zenspider) as a minimal testing framework, included in Ruby's standard library since Ruby 1.9.

SEE ALSO

rspec(1), rake(1), ruby(1), test-unit(1)

Copied to clipboard