cookbook

General Philosophy

RSpec

  # ✗ Avoid
  user.name.should eq "Davy Jones"

  # ✓ OK
  expect(user.name).to eq "Davy Jones"
  
  # ✓ OK
  it { should validate_presence_of(:name) }

describe

context

it

pending

Metaprogramming Tests

Rails

Model specs

View specs

Don’t. Prefer to use this time to write feature specs instead.

Controller specs

Lib specs

Helper specs

Mailer specs

Request specs

Feature Specs

Factories


Taken from proudcloud/awesome