rubocop-minitest icon indicating copy to clipboard operation
rubocop-minitest copied to clipboard

Detect missing `super` calls in `setup` and `teardown`

Open andyw8 opened this issue 4 years ago • 3 comments

From the minitest README:

If you want to extend your test using setup/teardown via a module, just make sure you ALWAYS call super.

I'd love to have a cop to check for this.

Is your feature request related to a problem? Please describe.

While debugging some intermittently test failures, I found a missing setup call.

Describe the solution you'd like

.

Describe alternatives you've considered

.

Additional context

.

andyw8 avatar Oct 28 '20 21:10 andyw8

I think this is worth mentioning in the style guide. Can you open the proposal with example code to the Minitest Style Guide? https://github.com/rubocop-hq/minitest-style-guide

koic avatar Oct 29 '20 02:10 koic

https://github.com/rubocop-hq/minitest-style-guide/pull/35

andyw8 avatar Oct 29 '20 03:10 andyw8

Static analysis does not know if included module contains setup and teardown methods - so I am not sure if this cop can be implemented effectively.

tejasbubane avatar Nov 05 '21 18:11 tejasbubane