redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

Handle stub args whose `hash` changes #198

Closed jcredding closed 10 years ago

jcredding commented 10 years ago

This updates the stub call logic to rehash its Hash when it can't find a matching stub for a set of args. The goal of this is to fix a bug with args whose hash changes after they have been used in a stub. When this happens, a Hash can't reliably find the object. In practice, a method would be stubbed, some code would execute that modifies the hash of the args and then when the stub was called, it would raise an error saying there wasn't a matching stub.

This also changes the exception classes that are thrown. With this change, the rescue needs to only rescue not stubbed errors and not the arity mismatch errors. There is now a not stubbed error and an arity error and they are thrown for their specific scenarios.

@kellyredding - Ready for review.

kellyredding commented 10 years ago

@jcredding nice catch on this. like the solution too - exception stuff is good :-1: