title: rake test prepare: NoMethodError: undefined method `[]' for nil:NilClass
body: <p>I always get the following error when I run rake db:test:prepare. what can cause this? rake db:create works fine. </p>
  
  <pre><code> Adam-MacBook-Pro:katy adam$ bundle exec rake db:test:prepare
      rake aborted!
      NoMethodError: undefined method `[]' for nil:NilClass
      /Users/adam/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:163:in `purge'
      /Users/adam/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:356:in `block (3 levels) in &lt;top (required)&gt;'
      /Users/adam/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:362:in `block (3 levels) in &lt;top (required)&gt;'
      /Users/adam/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
      /Users/adam/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `&lt;main&gt;'
  </code></pre>
  
  <p>database.yml</p>
  
  <pre><code>&lt;%= Rails.env %&gt;:
    adapter: mysql2
    encoding: utf8
    pool: &lt;%= ENV['DB_POOL'] || 5 %&gt;
    username: &lt;%= ENV['DB_USER'] || 'root' %&gt;
    password: &lt;%= ENV['DB_PASSWORD'] || nil %&gt;
    timeout: &lt;%= ENV['DB_TIMEOUT'] || 5000 %&gt;
    host: &lt;%= ENV['DB_HOST'] || 'localhost' %&gt;
    port: &lt;%= ENV['DB_PORT'] || 3306 %&gt;
    database: &lt;%= ENV['DB_NAME'] || "website#{Rails.env}" %&gt;
  </code></pre>