MiniTest is a Ruby testing library that comes built in to Ruby, itself. While there are a number of other testing libraries in the Ruby ecosystem, we will focus on MiniTest because of its inclusion in Ruby by default. In this lesson, we will explore the different functionality provided by MiniTest and how to use it to solidify our code.
Before we can write the world's best test suite, we must first understand how to structure a test and run the tests. First, we create a file called tests.rb
, and we place the following inside of it:
require "minitest/autorun"
class TestReality < MiniTest::Test
def test_the_universe_still_works