-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
QUnit start and stop not happening for promises within controller actions. #77
Comments
This depends somewhat on the version of Ember you are using. As of 1.6.0 RSVP based promise used in testing avoid the auto-run assertion that has plagued earlier versions. The specific example that you referenced though is referring to your test returning a promise, nothing more (AFAICT). |
I am happy to tweak the verbiage of that to make this more clear, but I do not think this is a fundamental problem of this library so I am closing this issue. |
I'm using ember-cli 0.0.39 with ember 1.5.1
If I understand you correctly, if I upgrade to Ember 1.6.0, the tests that I have written in that code example should work? If not, how would I need to modify the test for it to do so - is there a test case perhaps for this library which shows how to test an asynchronous action?
My test is not returning a promise (no return statement, should always be undefined). It is the subject of the test, an action on the controller, that is returning the promise. Even when I remove the return in the action, and simply use a promise inside of the action, the same error occurs. |
The async support that ember-qunit comes with (and is referenced in the README) is specifically referring to any promises returned from your test, not that any promises work anywhere and you don't have to worry about it. |
Ah, thanks for clearing that up! So, is it possible to test an asynchronous action on a controller using ember-qunit? |
The section on async example
says that "Under the hood, if you use Ember.RSVP.Promise, ember-qunit will call QUnit's start and stop helpers to stop the test from tearing down and running other tests while your asynchronous code runs. ember-qunit also asserts that the promise gets fulfilled."
This appears to happen in the general case, but not when an
Ember.Controller
is being tested,and action is sent to it:
This can be inferred from an error that occurs in subsequent, unrelated, tests in other test modules, saying "Uncaught Error: Assertion Failed: calling set on destroyed object"
Code example
The text was updated successfully, but these errors were encountered: