[rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)
Scott Taylor
scott at railsnewbie.com
Fri Feb 6 13:21:45 EST 2009
On Feb 6, 2009, at 12:50 PM, Stephen Eley wrote:
> On Fri, Feb 6, 2009 at 12:17 PM, Fernando Perez <lists at ruby-
> forum.com> wrote:
>>
>> The next big step will be specing controllers, as it is more painful
>> than models, but now that my controllers are ripped I guess it will
>> be
>> easier.
>
> I've stopped. Mostly because of the question Jay asks in that
> article: "Why are you testing?" I realized I had *no idea* why I was
> testing controllers, except that I had been lurking here and reading
> the RSpec docs and assumed that was the Way It Was Done. Finessing
> all those mocks and stubs does chew up major time, and I noticed that
> the controller code I was spending all that time writing stubs around
> wasn't typically code that broke. Most controllers for most apps are
> so boilerplate that if you can trust your framework (Rails or Merb)
> you can probably trust the controller.
+1
I've found that sometimes writing a very *simple* controller test,
which hits the db is a better solution when you don't have the time
and resources for a full cucumber story.
Mocking a controller without some sort of macros (like rspec-on-rails-
on-crack) is just too laborious and repetitive for my liking.
Scott
More information about the rspec-users
mailing list