drapergem/draper — pull request #388 by tovodeverett (2012-12-13 20:23:44+00:00)
Title: Fix caching behavior in CollectionDecorator#decorated_collection

I think I wrote enough tests to ensure the new logic in `CollectionDecorator#decorated_collection` is correct. My goals in this implementation were:
* Check for any scenarios where the cached decorators no longer match the underlying source objects.
* Not replace @decorated_collection with a new array (my initial approach did this, and several tests blew up that were placing mocks on @decorated_collection).
* Have fast behavior for calls where there are no existing decorators.
* Preserve existing decorators wherever possible.