Hacker News new | ask | show | jobs
by pc86 3059 days ago
Serious question: how do you test something without injection?

But yes I agree injecting configuration seems sub-optimal at best.

2 comments

Read about Ruby and DHH's opinion on DI. That's how.

Also, remember there's a huge swathe of apps where tests are wholly inappropriate and designing everything around DI is annoying for all those cases.

Prototypes, one time apps, internal tasks, the significant proportion of programmers who think testing's a waste of time and/or money, etc. or that only small, key parts should be tested.

In the case of the configuration manager, the test project would have its own underlying configuration file.