redding/ardb — pull request #60 by jcredding (2014-03-17 19:41:49+00:00)
Title: Update `RelationSpy`, allow from expressions, tweak except/only

This updates the `RelationSpy` to align it as a better spy for
`ActiveRecord::Relation`. This adds a `from` method that allows
applying "from" expressions and testing for those. This works
the same way the other expressions do. This also updates the
relation spy to better support duping/cloning. Previsouly, the
shallow copy that is the default for ruby objects would leave
2 spies sharing applied and results arrays. This updates them
to ensure they dup/clone these as well. This is used by the
`only` and `except` methods which now properly dup the relation
and return a new one with the modifications. This is how
ActiveRecord's methods work.

@kellyredding - This is needed to test some updates for MR related to counting grouped queries.