Skip to content
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

Not possible to mock multiple save() calls with handleCreate #88

Closed
soeffing opened this issue Jun 1, 2015 · 5 comments
Closed

Not possible to mock multiple save() calls with handleCreate #88

soeffing opened this issue Jun 1, 2015 · 5 comments

Comments

@soeffing
Copy link

soeffing commented Jun 1, 2015

I have code in which I have a loop and inside this loop I call save().

Example:

[1,2,3].forEach(function(ribbon) {
  this.store.createRecord('award', { ribbon: ribbon }).save();
});

It is possible to mock one request. For instance, I can mock the first request of the loop by doing this inside my tests:

TestHelper.handleCreate('award'); 
// OR
TestHelper.handleCreate('award').match({ribbon: 1});

But the subsequent requests are not being mocked. I would expect that TestHelper.handleCreate('award'); mocks all the three request inside the loop but it does not. Is there a way to stub multiple request with one .handleCreate() statement?

@danielspaniel
Copy link
Collaborator

Hmmm .. @soeffing .. that is a good question .. you're right .. that should just work. I will investigate that and see if I can fix it.

@soeffing
Copy link
Author

soeffing commented Jun 1, 2015

@danielspaniel thx a lot! Let me know if and how I can help you...your addon is great and we really want to use it!

@danielspaniel
Copy link
Collaborator

no problem @soeffing .. thanks for the offer to help out :)
I think I can get this done today or tomorrow ..

@danielspaniel
Copy link
Collaborator

@soeffing .. this is now fixed in version 1.0.10 of factory guy, and thank you for bringing this bug to my attention

@soeffing
Copy link
Author

soeffing commented Jun 3, 2015

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants