The first post ended with having that error.

Assertion failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an

When looking into why and where that happens everything started to get confusing, at least for me. At Ember Test helpers it stated that: Asynchronous helpers are "aware" of (and wait for) asynchronous behavior within your application, making it much easier to write deterministic tests. I used the click helper which should / was aware of asynchronous behaviour, but not for me? I tried to sprinkle inside my app code that's what was states as a solution for that. But that didn't work. I didn't investigate any further because it seemed wrong. Hint: It IS wrong. Don't do it!!!

I made a assumption which I have as long as being a webdeveloper. I can use jQuery everywhere. Thanks to the help of @locks on slack I found my problem which I didn't think of:

you shouldn't need to wrap things in in your app code, unless it's like an ajax cal
and you're not using ic-ajax


I was using jQuery to do the ajax request to the server. I was using pretender to stub the server in the test environment but that didn't change anything. I 'just' changed every $.post to ajax({url: '/api/some/url/', type: 'post', data: {/*your data here*/}}). Don't forget that ic-ajax returns a promise and doesn't allow for the callbacks inside the function call. So it looked like this before:

$.post('/api/users', {email:someprop, password: someotherprop}, function() {
  me.set('showRegisterSuccess', true);
  }).fail(function(error) {

and after the change

import Ember from 'ember';
import ajax from 'ic-ajax';

// ... some more code

ajax({ url: '/api/users', data:{email:someprop, password: someotherprop}, type: 'post'}).then(function() {
  me.set('showRegisterSuccess', true);
  }).catch(function(error) {

After that ember didn't break anymore and I could go and stub the following request to the one that failed. I was happy.


The problem with jQuery in that use-case is that it doesn't return a promise and ember can only work with that for detecting the asynchronous behaviour via the run-loop because it chains the other helper along the helper prior to them. It can't detect that there is still some code running if it is not using promises. Remember to always use ic-ajax when You want to test your code.

I learnt it the hard way so You don't have to.