superdevs the blog logo

RSS

TDD: Rails controllers tests with RSpec

SuperDevs is the first real world Ruby on Rails project we worked so we are learning things on the way.

We started writing controller specs using the default template proposed which looks a bit like this:

After a while those specs became a bit hard to read and often a bit brittle. We are now writing them in this format:

As you can see it is based more on the actual use cases than the implementation improving readability and maintanability.

How do you write your controllers specs?