Extract tests code out from AR's base_test.rb

Check commit message/description for further info :)