minitest
testing framework for Ruby that provides a complete suite of testing facilities
TLDR
Run all tests
$ ruby -Ilib:test [test/test_*.rb]
Run specific test filecopy
$ ruby -Ilib:test [test/test_example.rb]
Run tests with verbose outputcopy
$ ruby -Ilib:test [test/test_example.rb] --verbose
Run specific test methodcopy
$ ruby -Ilib:test [test/test_example.rb] --name [test_method_name]
Run with patterncopy
$ 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
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
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.