igrep / crispy

Test Spy for Any Object in Ruby.
http://rubygems.org/gems/crispy
MIT License
22 stars 2 forks source link

Better resetting #25

Closed igrep closed 9 years ago

igrep commented 9 years ago

Enhancement: Forget every spy log and reset stubbed methods by resetting.

This solves a possible problem when spying / stubbing an object used in many tests: With the existing resetting method (reset only when reinitializing), if the object is spied / stubbed in some tests but not in another, the object is unintentionally left spied / stubbed in other tests. So I decided to reinitializing every time CrispyWorld.reset_all.

In addressing the problem, I took care of not to hold extra spies after the target object is GCed with WeakRef.