Testing your Controller, using RSpec

If anyone is interested, I’ve written up a fairly basic tutorial going
over testing some features of your controllers, using RSpec. Am
looking for comments/constructive criticism on the article and if
there’s anything you’d like to see me write, am all ears! :slight_smile:

Article is here:

Enjoy, and feel free to comment!

Looks really good for a start.

Depending on the knowledge of the intended audience it may help
some people if you would explain what stubbing means. It’s an
concept of rspec and extremely helpful in many situations. Could
even get it’s own chapter.

A few issues:

  • You talk about TDD at its primitive finest, but you actually wrote
    code before the specs…

  • describe :login is not a clear description

  • Your users_controller is not designed restfully

  • The way you set session[:user] in the controller uses bad coding

Beside that, trying to teach people is also a good way to learn.