Subject blocks called multiple times for a single example
Created by: lackac
I ran into an issue where my explicit subject blocks were called multiple times. This caused my expectations set up with mocks to fail because through the subject block a stubbed method was also called multiple times.
I investigated the cause of this and it became clear that the subject block was only called multiple times if its return value was either nil
or false
. Caching the return value of the subject block should handle these cases as well.
Attached is a pull request with a scenario and a fix for this issue.