mot.la

Getting Started With Rails: Install Ruby, Rails, RSpec, Postgres, and Puma

In this article, I show you how to setup Ruby on Rails with RSpec, Postgres, and Puma

Install Ruby

ruby-install ruby 2.3.1 --system

For simplicity I prefer to have only one version of ruby installed. [1]

Install Postgres

Download Postgres.app onto your machine and follow the installation process.

Install Rails

gem install rails

Create a project.

rails new yourapp --database=postgresql

Enter the project.

cd yourapp
bin/rake db:create

Install Puma

Add puma to Gemfile and run bundle install.

gem 'puma'

Finally, run the server.

bin/rails server -b 127.0.0.1 -p 3000

Visit http://localhost:3000

Install RSpec

Add rspec-rails to Gemfile.

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

Then:

bundle install
bin/rails generate rspec:install
rm -rf test
bundle binstubs rspec-core

Then run your tests:

bin/rspec

That's it!

You're all set. You have a good foundation for building out your Rails application.


[1] zaiste.net/2013/04/towards_simplicity_from_rbenv_to_chruby/