Showing posts with label Ruby on Rails. Show all posts
Showing posts with label Ruby on Rails. Show all posts

Ruby on Rails / How to change controller name

Things to take care of when changing controller name
  • Controller name and optionally directory name
  • Controller class name in class XxxController < ApplicationController
  • Associated routes in routes.rb
  • *_path and *_url URL helper instances

Ruby on Rails / Test pride

In order to make your test output a little bit more interesting, use the --pride option within TESTOPTS:

TESTOPTS='--pride'

and here's what it does:









Rails testing / How to use assert_equal on arrays

The answer is simple: don't.
Instead use assert_same_elements from gem shoulda. Details below.

Imagine you have a test like this:

and a fixture file that looks like the following: