When I run Minitest in rails with more than one file, the setup method is only run for one class.
For example, if I run rails test test/controllers, I get the expected results. None of the controller tests have a setup method.
However, if I run rails test test/models, then the first file executed runs correctly (it contains a setup method), but the second file's setup method doesn't ever run. If I run each model test separately, they behave as expected.
Any idea what I'm doing wrong?
It turns out that I'm an idiot. I created the test files for my model helpers by copying a template file. When I did this, I forgot to change the class names. Thus, I had several test rb files that all contained the same class. Because ruby has open classes, this had the effect of adding the tests from each file to a single class but each subsequent file replaced the previous file's setup method. 🤦
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With