seattlerb/minitest — pull request #147 by floehopper (2012-07-19 17:18:55+00:00)
Title: Setup and teardown hooks should be run even in a TestCase.

Since `TestCase.add_setup_hook` and `TestCase.add_teardown_hook` are
defined on `TestCase` it seems logical that they should run when you run
a `TestCase`, not just when you run a `Spec`.

I considered simply moving the definitions of `Spec#run_setup_hooks`
and `Spec#run_teardown_hooks` from `Spec` up into `TestCase`, but this
would mean that anyone defining their own `#setup` or `#teardown`
method would have to remember to call `#super`, which I suspect is not
common practice. This way the hooks are guaranteed to fire.

Another possible solution would be to move `TestCase.add_setup_hook` and
`TestCase.add_teardown_hook` down into `Spec`, but I think this
mechanism is likely to be just as useful to `TestCase` diehards, so it
would be a shame to deny them.