Search code examples
ruby-on-railsherokuruby-on-rails-4heroku-postgres

running rails spec tests on heroku postgres


I am trying to use a free heroku postgres instance to use as my test database, but I am running into a problem as the first step seems to be for minitest to drop the database, which heroku postgres doesn't allow instead it allows to purge the database I think.

action@clinio2-13639:~/workspace/clinio(master*)$ rake                                                                                                                                                           
    rake aborted!                                                                                                                                                                                                    
    FATAL:  permission denied for database "postgres"                                                                                                                                                                
    DETAIL:  User does not have CONNECT privilege.
    ......
    Tasks: TOP => db:test:load => db:test:purge                                                                                                                                                                      
    (See full trace by running task with --trace)   

not sure how to get past this error. And my dev environment I dont have root privlidges so I cant set up a local postgres instance which would obviously be ideal. Any help would be much appreciated!


Solution

  • Unfortunately, I think you just really need root privileges in a development environment. Heroku is pretty locked down, so it's not ideal for testing. Here are some options:

    • Find or buy a cheap machine to use for web development. If you're familiar with Linux (or are open to becoming more familiar), you have a free operating system to install that works really well with rails development. I do all my webdev work in Linux and recommend Linux Mint for newcomers.
    • Check out Nitrous.io. I haven't used it, but it looks interesting and it seems to have a free option for in-browser web development. I'm not sure if it would provide the kind of environment you need and am not in any way affiliated with the service.