-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handleCreate seems to require an Em.run #62
Comments
@Grantovich .. yes .. I have the same issue, and I wrap all tests in a run loop that use handleCreate and other methods as you say that have async side effects .. do you think it is better for me to wrap that call in handleCreate with run loop, or for you to wrap your tests? |
I'm not sure of the solution, but as someone using an Ember library I usually expect that all the library's functions will work in a default Ember environment, unless documented otherwise – and by default, tests are not wrapped in a run loop. Possible solutions, in increasing order of complexity:
|
Good analysis, and I vote for #3 .. it is annoying that I am creating a record to be able to use the serializer .. but I could not find a way around it .. all entry to serializer uses a record .. ( that I could find ) .. could you take a look at what I am doing and see if you have another way to accomplish that .. ?? |
I'll take a look when I have some free time. It might not be necessary to do the serialization if |
Well, the problem or lack of problem is that handleUpdate does not do any matching... it just mocks an update .. and does not care about what exact attributes are being updated. handleCreate on the other hand does try and make that match .. which I added because people have asked me to make handleCreate with ability to match attributes. It used to be just like handleUpdate ( did not bother with matching ) .. |
I have not found another way to avoid creating the new record. I am going to go with idea #2 then, and wrap the call to createRecord in Em.run call .. and will commit that code and make a new version ( next few days ) |
I have setup my tests so they fail now without that run loop as they should have before ( I had forgotten to setup my tests the way a normal Ember application would by calling the setupForTesting method. |
That's odd... in my tests, wrapping just the |
Ok .. let me clear up what I meant. |
When using
testHelper.handleCreate
in an acceptance test, I get an error that requires me to wrap it in anEm.run
call. It looks like this is becausehandleCreate
usescreateRecord
, which can have asynchronous side effects.The text was updated successfully, but these errors were encountered: