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

Zach Dennis zach.dennis at gmail.com
Wed Jan 2 14:20:30 EST 2008


On Dec 30, 2007 4:47 AM, Kero van Gelder <kero at chello.nl> 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?
>
> A Hash is not ordered.
> (but the 1st set of statements is)

I don't know if this matters in this case. RSpec doesn't enforce
strict-order mocking. Nor does Mocha. Hardmock is the only mocking
library in ruby that I know of that can do this,

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


More information about the rspec-users mailing list