-
-
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 does not mock response with relationships #141
Comments
hmm .. @FilmKnurd .. give this a try
|
I actually remove any belongsTo associations in handleCreate Response .. because there were problems ( forgot what they were ) .. and it was redundant because if create a model with a belongsTo that exists in the store .. it will just 'be there' when the payload returns and makes the model for real |
Thank you for your help. Unfortunately, it didn't work. The campaign that is made explicitly with |
can you do this
in your app code and then run the test. |
|
that is interesting .. can you how me the model def's .. are they async: true ? also .. you said before that this was the code:
that makes the campaign .. so now I am thoroughly confused .. have no idea what is where .. |
Sorry, I was trying to pair the code down to the essentials, because the model has bunches of other properties on it. Basically, we are dealing with two campaign models. The first is a parent and the second is a child. The parent already exists and is the parameter that is passed into The Website is declared with Is that helpful? |
kind of .. what would really make me see the light and allow me to fix/analyze quickly is if you cloned the repo and made a failing test that showed this setup .. then it's awholelottta better to see and muchmore painlesser to fix |
Hmmmm... I'm having trouble making a red test in your repo :-) There must be something fishy going on in my code. |
Yeah .. I think there is too .. just something a teeny bit different somewhere .. I think that the fact that |
That is super generous of you. I'm going to tinker with it some more tomorrow and I'll let you know. It's not a huge blocker for me at the moment. |
Have you made more progress. I am just way behind on my other work, so I just worked on that all day. Which is a bummer, because i am curious to fix this one. |
I have not had a chance to take another stab at it yet. I was planning on not bothering you until I've taken a second look :-) |
I appreciate that .. cause I am maniacly busy |
I think v2.6.2 fixed this issue .. if not let me know .. and I will reopen this. but I am confident :) |
Am I correct in thinking that
handleCreate
should mock the response with values for every attribute specified on the created record? I am not seeing relationship properties on the payload and, consequently, I cannot get those properties off the mocked model.For example, after creating a model, I transition into a route that loads a related model. In the test, however, the mocked model does not have the relationship and so Ember Data complains that I am passing undefined into
store.find()
.App Code (
some route
)App Code (
edit route
)Factory
Test
I have tried adding
.andReturn({ website: [website] })
Where website was both the website from the campaign, or the website id. But neither had any affect. Name and any non relationship property comes through just fine. It's only related models with which I am having trouble.Am I using
handleCreate
correctly?The text was updated successfully, but these errors were encountered: