(Here's my proposed fix for this)
First, print out the test names:
$ ruby minitest.rb -v
Run options: -v --seed 58440
# Running tests:
AnotherTest#test_something = 0.00 s = F
MyTest#test_something = 0.00 s = .
Finished tests in 0.000664s, 3012.0482 tests/s, 3012.0482 assertions/s.
1) Failure:
test_something(AnotherTest) [minitest.rb:12]:
Epic Fail!
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
Next, try running a specific test:
$ ruby minitest.rb -n "AnotherTest#test_something"
Run options: -n AnotherTest#test_something --seed 8523
# Running tests:
Finished tests in 0.000480s, 0.0000 tests/s, 0.0000 assertions/s.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
What? Nothing ran? Indeed. It's because as far as MiniTest cares, the suite name isn't part of the test name. So you can only use parts of the test name in your filters:
However, there's no guarantee (nor should there be) that test names will be unique across suites:
$ ruby minitest.rb -n "test_something"
Run options: -n test_something --seed 30485
# Running tests:
F.
Finished tests in 0.000645s, 3100.7752 tests/s, 3100.7752 assertions/s.
1) Failure:
test_something(AnotherTest) [minitest.rb:12]:
Epic Fail!
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
So when we try to target a single test, both tests run. Bums.
I've implemented my attempt a fix here: lazyatom/minitest@2b12aaa
Any thoughts?