I have a series of rake tasks in a Rakefile which I\'d like to test as part of my specs etc. Each task is defined in the form:
task :do_somthing => :environme
I think you are looking for this line: require(File.join(RAILS_ROOT, 'config', 'environment')) it's exactly what you find in "task :environment" implementation
I use it to test my rake tasks using rspec