Let’s imagine, that we test a controller method - isolated peace of
code with a well-defined responsibility: treat request and produce
response (and may be also authorize user). We set up our mocks and
stubs, i.e. doing minimal setup for running single method.
And what we have? Test fails because view-file called methods of your
model, which you did not mocked or stubbed. So, we have to setup
UNNESSESARY stub-methods/mock-expectations because of code, which has
no meaning during the test. As a result, our nice simple test code
grows up to a unreadable monster.
Does anyone have experience with solving this problem?