rails new app_name -d postgresql
Given that you want to use postgresql. exclude -d postgresql to setup with SQLite.
- edit yml (if applicable)
- edit gemfile --> see 'gemfile for dev/test' gist
bundle install
rails g rspec:install
bundle exec guard init
- In the guard file:
guard :rspec, cmd: 'bundle exec rspec’ do
bundle exec guard
- create spec folder (models) and file (user_spec.rb) --> spec/models/user_spec.rb
rake db:migrate RAILS_ENV=test
rails g jasmine:install
rails g jasmine:examples (optional)
- create file (js_file.js) in assets/javascript/js_file.js
- create file (js_file_spec.js) in spec/javascript/js_file_spec.js
rake jasmine (starts server - check tests in browser at --> localhost:8888)
write a test!!
or
set up db:
rake db:create
rails g migration create_users
- make table!!!
rake db:migrate
write a test!!_
db:create --> creates the database for the current env
db:create:all --> creates the databases for all envs
db:drop --> drops the database for the current env
db:drop:all --> drops the databases for all envs
db:migrate --> runs migrations for the current env that have not run yet
db:migrate:up --> runs one specific migration
db:migrate:down --> rolls back one specific migration
db:migrate:status --> shows current migration status
db:migrate:rollback --> rolls back the last migration
db:forward --> advances the current schema version to the next one
db:seed --> runs the db/seed.rb file
db:schema:load --> loads the schema into the current env's database
db:schema:dump --> dumps the current env's schema (and seems to create the db as well)
db:setup --> runs db:schema:load, db:seed
db:reset --> runs db:drop db:setup
db:migrate:redo --> runs (db:migrate:down db:migrate:up) or (db:migrate:rollback db:migrate:migrate) depending on the specified migration
db:migrate:reset --> runs db:drop db:create db:migrate