1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-02 22:58:01 +00:00
Files
til/ruby/running-a-single-minitest-example.md
2016-04-02 11:23:33 -05:00

756 B

Running A Single MiniTest Example

Consider the following MiniTest file:

# test_stuff.rb
require 'minitest/autorun'

class TestStuff < MiniTest::Unit::TestCase
  def test_first_thing
    assert_equal 4, (2 * 2)
  end

  def test_second_thing
    assert_equal 9, (3 * 3)
  end
end

If we want to run all the tests in this file, we can do so with:

$ ruby test_stuff.rb

But what if we want to run a specific test? We can target a single MiniTest example with the --name flag and the name of that example. We can do something like the following:

$ ruby test_stuff.rb --name test_second_thing

source