[rspec-users] Do you think it would look cleaner?

Zach Dennis zach.dennis at gmail.com
Sun Dec 30 01:49:05 EST 2007


On Dec 29, 2007 1:29 PM, Pat Maddox <pergesu at gmail.com> wrote:
>
> On Dec 28, 2007 11:00 PM, Andrew WC Brown <omen.king at gmail.com> wrote:
> > I was looking over some of my specs.
> > I was thinking that the following:
> >
> > @game.should_receive(:name).and_return('The Battle for Blaze')
> > @game.should_receive(:people).and_return(5000000)
> > @game.should_receive (:activated).and_return(true)
> >
> > Would it look cleaner if I could do this instead?
> >
> > @game.should_recieve_and_return(
> >   :name => 'The Battle for Blaze'
> >   :people => 5000000
> >   :activated => true)
> >
> > Opinions?

I find this more confusing. When I first read it I thought it was
going to receive the hash as arguments and return the hash. I think
the expressiveness of "should_receive(...).and_return(...)" wins in
this case,

-- 
Zach Dennis
http://www.continuousthinking.com


More information about the rspec-users mailing list