add tests for to_key implementation for ActiveRecord::Base

This is an amendment for the PR https://github.com/rails/rails/pull/15163 where the tests need to be moved to activerecord/test instead of activemodel/test directory