Often I would extract methods from blocks of existing code to make things clearer or easier to refactor later. However, these tiny methods should not be part of the public API, therefore I’d like to mark them as private. But this causes 2 problems:
- Since these are private, i have to use
instance_evalto call them, which leaves me an uneasy feeling.
- Since these are inner workings of an object, often they evolve very quickly. So the tests I write for these are more brittle and likely out-of-date quickly.
So my questions are should I write explicit tests for these? If so, other than instance_eval, are there other ways I can write them?