arunoda / nodemock

Simple Yet Powerful Mocking Framework for NodeJs
http://arunoda.me
MIT License
75 stars 1 forks source link

partial comparison of arguments #3

Closed dominictarr closed 13 years ago

dominictarr commented 13 years ago

sometimes you don't need to check EVERYTHING about an object to know it's correct. especially when the object is likely to change or be added to.

for example, it would be great to be able to do this:

var mocked = nm.mock('foo').takes({atLeast: true, andThis: false})

mocked.foo({atLeast: true, andThis:false, ignoreThisExtraStuff: 'whatever'})

turns out nodemock already supported this, but in reverse. you could put extra properties in takes({}) and ignore them when the mock was called.

I've made tests to check for the correct behavior, and then fixed it.

turns out it was just a one line fix.

cheers. Dominic

arunoda commented 13 years ago

Yes ill agree to your patch. I'll merge it. Need to run tests and verify. Thanks for your patch