[rspec-users] Working outside-in with Cucumber and RSpec

Pat Maddox pergesu at gmail.com
Fri Oct 31 20:17:47 EDT 2008

Nick Hoffman <nick at deadorange.com> writes:

> On 2008-10-30, at 15:31, Pat Maddox wrote:
>> eh I dunno.  I mean, I completely agree that hard-to-write tests often
>> expose bad code.  But there isn't any gray area when it comes to
>> designing Rails controllers, in my opinion.  I see an action that's
>> more
>> than five lines long and I know it's wrong.  I don't need to write
>> examples to tell me that.
> Hi Pat. Would you mind suggesting how I can make this 22-line action a
> bit shorter?  =)
> http://refactormycode.com/codes/575-dry-up-a-controller-action

I should have known I'd get called out on this :)

I pushed around some stuff that I think should be in the model.  The
other thing that I thought, but didn't change (I don't really know what
you're doing with this action) is these render_to_string calls.  Maybe
you have a good reason for it, but I would just do regular "render
:partial..." calls in the view.


More information about the rspec-users mailing list