If you start your rake task with task :testclass => :environment do, your Rails environment will be loaded and available for the task.
If you start your rake task with task :testclass => :environment do, your Rails environment will be loaded and available for the task.