Basic TDD in Rails : Setup

Objective


  • To setup the environment

Environment


Ruby Version : 2.2.1
Rails Version : 4.2.
Rspec Rails Version 3.2

Steps


Step 1

Install Rails

gem install rails

Step 2

Create a Rails project

rails new --skip-spring blog

Step 3

Add project to bitbcket git repository

git remote add origin git@bitbucket.org:bparanj/tdd-rails-basics.git
git push -u origin --all # pushes up the repo and its refs for the first time

Step 4

Install Rspec Rails

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

bundle

Step 5

rails generate rspec:install

Output

create  .rspec
create  spec
create  spec/spec_helper.rb
create  spec/rails_helper.rb

Delete the test folder

Summary


In this lesson we installed rspec-rails for our new blog project so that we can start writing tests.


Related Articles


Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.