[rspec-users] What do you think of this controller spec?
pergesu at gmail.com
Sun Dec 24 15:53:02 EST 2006
Here's a controller spec I wrote, it's for a very simple RESTful
controller (well, aren't all RESTful controllers simple? :)
I've created a couple spec helper methods to refactor some of the
common code...for example, require_login_and_correct_user creates two
specifications: one for when the user isn't logged in, and one when
the user is logged in but requests someone else's book. do_request
automatically calls do_get/post/put/delete depending on what's
Here's all the code:
The specs just feel somewhat unwieldy to me...maybe it's because the
controller code is very simple and elegant, and the spec looks big and
bloated in comparison. Also, it feels like it's taking me a lot
longer to write the controller specs with all these individual
Am I just tripping for no reason, and the specs look fine? What would
you change? Also I know that the controller code could be improved by
using the finder on the association, this is just how I have it for
now. I'm interested in how the specs could be better.
I'll be understanding if I don't get a response for a few days :)
Merry Christmas everybody!
More information about the rspec-users