title: Only load rake rasks in a certain environment?
body: <p>Right now, I'm using bundler to manage my gems. Bundler loads different gems for different environments.</p>
  
  <p>I have some rake tasks that use testing gems (rspec), but these cause problems in production environments where that gem isn't loaded.</p>
  
  <p>So what I'd like to be able to do is to only have the rake task (and the require 'rspec/core/rake_task' line associated with it) load in the test environment.</p>
  
  <p>I can't quite figure out the best way to do this.</p>
  
  <p>I currently have:</p>
  
  <pre><code>require "bundler"
  require 'rspec/core/rake_task'
  
  desc "Task for running Rspec tests"
  RSpec::Rake::SpecTask.new(:spec)
  </code></pre>