Updated #14544 to work with `activerecord-deprecated_finders`

Used older style of lambda definitions within a test. Also explicitly check for
the case when `activerecord-deprecated_finders` is active in the context of scopes
and handles this case specially. This handling relies on and is meant to be used
in unison with https://github.com/rails/activerecord-deprecated_finders/pull/23.

Fixes Issue #13466. See #14544 for complete description.