Search code examples
postgresqlrspecruby-on-rails-3.2rspec-railsrails-postgresql

Way to use postgresql and avoid testunit by default in rails 3.2?


I'm tired of typing $ rails new [app name] -d postgresql --skip-test-unit every time I start a new rails app. I'm using rails 3.2.

Is there any way to make using postresql and skipping test unit my default for new rails apps?


Solution

  • Yes. Rails 3.2 makes setting those defaults easy by updating your ~/.railsrc file.

    At the command line:

    $ echo -d postgresql -T > ~/.railsrc
    

    Now every new rails app will use postgresql and avoid testunit.

    $ rails new [my new app]
    [my computer]:[my directory] [my name]$ rails new [my new app]
    Using -d postgresql -T from /Users/benjaminunger/.railsrc
      create  
      create  README.rdoc
      create  Rakefile
    .
    .
    .
    

    Any flag for the rails new generator can become a default by updating the ~/.railsrc file.