Closed misfo closed 10 years ago
It turns out this is a more general problem with Object#freeze
:
obj = Object.new
obj.singleton_class.frozen?
#=> false
obj.freeze
obj.singleton_class.frozen?
#=> true
There has to be a way to mock methods on frozen objects though...
@misfo I typically do not mock methods on a "random" object anymore. The ROM development style leads to very "small" public interface objects, so I generally pass a full instance in, or in rare cases a full mock. But no need to mock one of many methods if an instance.
Here's a minimal case:
This prevents Rspec from being able to mock methods on these instances