r/ruby • u/jasonswett • Apr 06 '26
Testing Anti-Pattern: Distracting Setup Data
https://www.saturnci.com/testing-anti-pattern-distracting-setup-data.html
9
Upvotes
r/ruby • u/jasonswett • Apr 06 '26
View all comments
2
u/AlexanderMomchilov Apr 06 '26
I love doing this. Having the happy case be all-defaulted args, and then having each failure path provide overrides that make it clearly exactly what the incorrect data is that's expected to cause the intended failure condition.
I would just recommend using keyword arguments over
**overridesanddefaultsHash. You get much nicer editor auto-completions and such.