Category Archives: Uncategorized

Command Line Recipes À la Stitch Fix

Here is a list of command line recipes that make day to day life a little easier at Stitch Fix.

Maybe you will find some of these useful for projects you are working on 🙂

Color Rspec Output for All Projects

Ran into an issue today where I wanted rspec to use color output regardless of whether or not the project had it set up in the .rspec or spec_helper.rb files.

A super simple way to do this is to update your .bash_profile and override the rspec command with the colour switch:

vi ~/.bash_profile

Add the following to .bash_profile and save:

alias rspec='rspec --colour'

Reload the file:

source ~/.bash_profile

And you should be all set! Just run rspec as you normally would and the colour switch will be added automatically via the alias.

Basic Controller Rspecs


Suppose the following method is there in the controller

def new
  @post =

For this the corresponding spec will be as follows

describe "GET #new" do
  it "creates new instance of post" do
    get :new
    assigns(:post).should be_a_new(Post)

In the above code “get :new” line will get the new path of the controller and execute the corresponding method described in the controller. So that particular statement is very important for execution of the method and comparison of the output in the test.

View original post 458 more words