Closed tonywok closed 9 years ago
Boy, that is a puzzler @tonywok, because this functionality has been pretty well tested .. and I retested it again today .. kept trying to make this not fail, but it works as expected for me. But maybe you are doing something in model, test, setup that is different? So .. try sending the model, the full test, the factory .. and I can then try and recreate this one. The matchArgs do survive the serialize call, but it was good idea to look there, because it made me wonder "Why am I passing in matchArgs to serialize method in the first place?" .. seems pretty useless thing to do. Turns out .. it was pretty dumb. So I took that out. Maybe you are using a custom serializer for that model that is messing with those options?
@danielspaniel That could be. It's an old (funny using that word) ember app, so there's lots of work arounds.
I'll take a closer look and resubmit if needed. Thanks.
First off, thanks for writing this library. I think it will drastically clean up my tests.
I'm using
handleCreate
to replace my existing sinon mock. After reading through the docs, I saw thematch
option. This seems like a really cool feature, but I keep getting false positives when trying to use it.For example:
I then proceed to write my test code to create an author with the name of "Tony". I would expect that to fail based on the match condition.
Upon closer inspection I saw the code inside
MockCreateRequest
'scalculate
method is callingtmpRecord.serialize(matchArgs)
. Looking at the ember data source, I see this forserialize
:So, it doesn't seem like the match args are actually going to survive beyond the call to serialize. That would explain my false positive. Am I interpreting your README correctly?
Thanks again :)
ember-data beta 16.1
ember 1.11.3
ember-data-factory-guy 1.0.7
ember-cli 0.2.3