[rspec-users] [RSpec] Cloning objects and leaking state

Pat Maddox pergesu at gmail.com
Wed Jan 28 12:16:23 EST 2009

> If it doesn't automatically clone (it may, I don't know), it probably
> should provide a lambda syntax so you can do:
> default :subtitles => lambda { [] }

Yeah, I just looked at the code for ARD and this is the problem.  You
can pass in immutable objects and they don't get affected for obvious
reasons.  But with a mutable object like an array, you need to pass it
a lambda so that it's creating a new instance each time.


More information about the rspec-users mailing list