title: Postgres on Rails FATAL: database "my_app_test" does not exist
body: <p>I have a new rails environment I'm setting up and I'm having some issues with postgres connecting to the database when running RSPEC tests.</p>
  
  <p>My environment is Ruby 2.2.4p230, Rails 3.2.22, Postgresql 9.4.5</p>
  
  <p>My database.yml file looks like:</p>
  
  <pre><code>  test:
      adapter: postgresql
      encoding: unicode
      database: myapp_com_test
      min_messages: WARNING
      pool: 5
      username: 
      password: 
  </code></pre>
  
  <p>I can run <code>rake db:migrate</code> and not receive any errors.</p>
  
  <p>I can also run <code>rails c test</code> and the console seems to launch and shows me:</p>
  
  <pre><code>Digest::Digest is deprecated; use Digest
  Loading test environment (Rails 3.2.22)
  [1] pry(main)&gt;
  </code></pre>
  
  <p>But when I run something like <code>rake db:test:prepare</code> it looks like it runs fine in that terminal window, but I receive a <code>FATAL:  database "myapp_com_test" does not exist</code> in the server window.  </p>
  
  <p>Along the same lines, when I run <code>rake spec</code> I receive the same <code>FATAL:  database "myapp_com_test" does not exist</code> in the server window along with this error</p>
  
  <pre><code>Connecting to database specified by database.yml
     (0.3ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" 
     (0.6ms)  SELECT version FROM schema_migrations ORDER BY version
     (126.3ms)  DROP DATABASE IF EXISTS "myapp_com_test"
     (236.5ms)  CREATE DATABASE "myapp_com_test" ENCODING = 'unicode'
  /Users/ryanfitch/.rvm/rubies/ruby-2.2.4/bin/ruby -S rspec ./spec/controllers/account_controller_spec.rb ./spec/controllers/artists_controller_spec.rb ./spec/controllers/contact_controller_spec.rb ./spec/controllers/exclusivities_controller_spec.rb ./spec/controllers/help_controller_spec.rb ./spec/controllers/home_controller_spec.rb ./spec/controllers/legal_controller_spec.rb ./spec/controllers/line_items_controller_spec.rb ./spec/controllers/mixtapes_controller_spec.rb ./spec/controllers/newsletter_controller_spec.rb ./spec/controllers/order_controller_spec.rb ./spec/controllers/originals_controller_spec.rb ./spec/controllers/registrations_controller_spec.rb ./spec/controllers/stations_controller_spec.rb ./spec/controllers/story_controller_spec.rb ./spec/controllers/tracks_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/decorators/exclusivities_decorator_spec.rb ./spec/decorators/station_decorator_spec.rb ./spec/features/user_creates_account_spec.rb ./spec/features/user_places_click_order_spec.rb ./spec/helpers/exclusivities_helper_spec.rb ./spec/helpers/stations_helper_spec.rb ./spec/models/address_spec.rb ./spec/models/artist_spec.rb ./spec/models/billing_information_spec.rb ./spec/models/exclusivity_spec.rb ./spec/models/license_spec.rb ./spec/models/line_item_spec.rb ./spec/models/mixtape_download_spec.rb ./spec/models/mixtape_spec.rb ./spec/models/order_spec.rb ./spec/models/outbox_spec.rb ./spec/models/promo_code_spec.rb ./spec/models/side_spec.rb ./spec/models/station_spec.rb ./spec/models/track_rank_spec.rb ./spec/models/track_spec.rb ./spec/models/user_spec.rb ./spec/models/vendor_spec.rb ./spec/routing/artists_routing_spec.rb ./spec/routing/contact_routing_spec.rb ./spec/routing/help_routing_spec.rb ./spec/routing/home_routing_spec.rb ./spec/routing/legal_routing_spec.rb ./spec/routing/mixtapes_routing_spec.rb ./spec/routing/originals_routing_spec.rb ./spec/routing/story_routing_spec.rb ./spec/routing/tracks_routing_spec.rb ./spec/views/stations/play.html.erb_spec.rb
  invalid option: --no-fail-fast
  
  Please use --help for a listing of valid options
  /Users/ryanfitch/.rvm/rubies/ruby-2.2.4/bin/ruby -S rspec ./spec/controllers/account_controller_spec.rb ./spec/controllers/artists_controller_spec.rb ./spec/controllers/contact_controller_spec.rb ./spec/controllers/exclusivities_controller_spec.rb ./spec/controllers/help_controller_spec.rb ./spec/controllers/home_controller_spec.rb ./spec/controllers/legal_controller_spec.rb ./spec/controllers/line_items_controller_spec.rb ./spec/controllers/mixtapes_controller_spec.rb ./spec/controllers/newsletter_controller_spec.rb ./spec/controllers/order_controller_spec.rb ./spec/controllers/originals_controller_spec.rb ./spec/controllers/registrations_controller_spec.rb ./spec/controllers/stations_controller_spec.rb ./spec/controllers/story_controller_spec.rb ./spec/controllers/tracks_controller_spec.rb ./spec/controllers/users_controller_spec.rb ./spec/decorators/exclusivities_decorator_spec.rb ./spec/decorators/station_decorator_spec.rb ./spec/features/user_creates_account_spec.rb ./spec/features/user_places_click_order_spec.rb ./spec/helpers/exclusivities_helper_spec.rb ./spec/helpers/stations_helper_spec.rb ./spec/models/address_spec.rb ./spec/models/artist_spec.rb ./spec/models/billing_information_spec.rb ./spec/models/exclusivity_spec.rb ./spec/models/license_spec.rb ./spec/models/line_item_spec.rb ./spec/models/mixtape_download_spec.rb ./spec/models/mixtape_spec.rb ./spec/models/order_spec.rb ./spec/models/outbox_spec.rb ./spec/models/promo_code_spec.rb ./spec/models/side_spec.rb ./spec/models/station_spec.rb ./spec/models/track_rank_spec.rb ./spec/models/track_spec.rb ./spec/models/user_spec.rb ./spec/models/vendor_spec.rb ./spec/routing/artists_routing_spec.rb ./spec/routing/contact_routing_spec.rb ./spec/routing/help_routing_spec.rb ./spec/routing/home_routing_spec.rb ./spec/routing/legal_routing_spec.rb ./spec/routing/mixtapes_routing_spec.rb ./spec/routing/originals_routing_spec.rb ./spec/routing/story_routing_spec.rb ./spec/routing/tracks_routing_spec.rb ./spec/views/stations/play.html.erb_spec.rb failed
  </code></pre>
  
  <p>Any ideas what's going on here? </p>
  
  <hr>
  
  <p>EDIT:
  I can run <code>rails db test</code> and it opens up the database console and shows me the schema so the test database and dev database are there and seem to be working - but Postgres still doesn't seem to find it when I run <code>rake spec</code> for some reason. </p>