Ruby on Rails Create a new Rails app with your choice of database and including the RSpec Testing Tool


Example

Rails uses sqlite3 as the default database, but you can generate a new rails application with a database of your choice. Just add the -d option followed by the name of the database.

$ rails new MyApp -T -d postgresql

This is a (non-exhaustive) list of available database options:

  • mysql
  • oracle
  • postgresql
  • sqlite3
  • frontbase
  • ibm_db
  • sqlserver
  • jdbcmysql
  • jdbcsqlite3
  • jdbcpostgresql
  • jdbc

The -T command indicate to skip the installation of minitest. To install an alternative test suite like RSpec, edit the Gemfile and add

group :development, :test do
  gem 'rspec-rails', 
end

Then launch the following command from the console:

rails generate rspec:install