El jue, 25-09-2008 a las 12:44 +0100, Matt Wynne escribió: > > > Have a look at this: > http://gist.github.com/12805 > > When you call foo -= 1, ruby does two things: > > (1) asks foo for its value > (2) tells foo to have a new value, one less than the answer it got > back from the first question. > > If you re-write more verbosely, you'll see what I mean: > > foo = foo - 1 > > Two operations are being done to foo. So if you want to mock out foo, > you have to mock out both those operations. > > Make sense? > > cheers, > Matt > ---- > http://blog.mattwynne.net > http://songkick.com > > In case you wondered: The opinions expressed in this email are my own > and do not necessarily reflect the views of any former, current or > future employers of mine. > > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Thanks. I'm understand what I must do to test this type specifications. I changed my code and now it's work fine, but I have one question: What way it's better to test this method? Using a real instance of game, or using a mock? Thanks ;). _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users