Refactor expectation-finding logic.
Refactor expectation-finding logic.

Besides the improved readability of this code, I think it should be
slightly faster in certain circumstances. The old version would scan
the full list twice; this only scans the list once.
h4ck3rm1k3/rspec-mocks,rwz/rspec-mocks,maclover7/rspec-mocks,thoughtbot/rspec-mocks,rspec/rspec-mocks,maclover7/rspec-mocks,zephyr-dev/rspec-mocks,telekomatrix/rspec-mocks,AEgan/rspec-mocks,samphippen/rspec-mocks,ducthanh/rspec-mocks,samphippen/rspec-mocks,thoughtbot/rspec-mocks,zephyr-dev/rspec-mocks,h4ck3rm1k3/rspec-mocks,AEgan/rspec-mocks,ducthanh/rspec-mocks,telekomatrix/rspec-mocks,rspec/rspec-mocks,edwardpark/rspec-mocks,edwardpark/rspec-mocks,rwz/rspec-mocks