David Chelimsky

random thoughtlessness

Inferred Controllers and Helpers in Spec::Rails

Here’s a nice little enhancement in Spec::Rails-0.9.

Up until now, controller examples required that the controller be named:

<code>#the old way
context "Login Controller" do
controller_name :login
...
</code>

You’ll still be able to do that, but you’ll also be able to do this:

<code>describe LoginController do
...
</code>

… and Spec::Rails will assume that LoginController is what you want to use.

This works for your helper examples as well:

<code>describe PeopleHelper do
...
</code>