-
-
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
Integration tests bypassing store and making server requests. #27
Comments
Ooo .. yes, forgot to add a convenience method ( and or documentation ) to handle that case ( for loading many models like that .. ) You could do something like: responseJson = FactoryGuy.buildList('album', 5)
testHelper.stubEndpointForHttpRequest( '/api/albums', albums: responseJson ) And this would replace: albums = store.makeList('album', 5) and that should do it .. ( it's what I do in my own tests ) |
We're using Ember 1.7.0 and EmberData 1.0.0-beta.10 at the moment, will likely update once I get some time. That works perfectly thanks. Slightly off topic but the instructions for adding this to an embercli project aren't that clear, initially I had some issues around jquery.mockjax not getting pulled in via either |
Great .. glad you are all set with that. |
I'm not really familiar with how package management works with node/js stuff and whether you can just get it to install mockjax as a dependency of this package. That's certainly how I'd expect it to work from ruby. But it is confusing to be able to use ember-data-factory-guy without needing mockjax then using a new part of the api and suddenly things don't work (cause you're missing mockjax). |
Agree .. I was trying to be too minimalist and not include something if some did not use it, but it then backfires if you actually use it. Will include mockjax fom now on to avoid that confusion. |
mockjax is now included in the ember-data-factory-guy dist file. This is as of version 0.7.6, which also has a new method handleFindMany in the FactoryGuyTestMixin class, which does kind of exactly what I just showed you above, but what the heck, it's a one liner instead of 2 now. |
Thanks I'll get this updated ASAP. |
I'm writing integration style tests for my embercli project and have come across an issue where I think I've stubbed correctly but still see network requests.
This is my integration spec which visits a particular route that loads all the
album
models so I've created a bunch of albums viastore.makeList('album', 5)
which I was expecting to prevent any real ajax calls being made.Despite this setup I still see
GET http://localhost:4200/api/albums 404 (Not Found)
when I run the embercli tests in a browser. I've tried using thehandleFind
function but that seems targeted towards an individual model and doesn't work either.Am I missing part of the API that covers stubbing out things like
@store.find('albums')
which loads all albums? It seems like those calls bypass anything in the store and always try to make an ajax call.Any help would be appreciated. Other than this issue I'm really liking this library, seems to do most of the things I want and makes it very easy. Cheers.
My model definition
and the fixtures file.
The text was updated successfully, but these errors were encountered: