trek/ember-testing-httpRespond — pull request #13 by rjackson (2014-03-13 02:04:06+00:00)
Title: Add new helper visitAndRespond to fix issues with Ember >= 1.4.0.

Details from #10:

1. The `wait` helper in `ember-testing` is intended to wait for the routing transition to be completed (See [here](https://github.com/emberjs/ember.js/blob/master/packages_es6/ember-testing/lib/helpers.js#L146-148)). 2. `httpRespond` is setup via `registerAsyncHelper`. 3. An async helper from the perspective of the `ember-testing` package chains off of the previous promise. 4. Because of the above, `httpRespond` never gets a chance to respond, and causes the test to hang (waiting on the router to resolve its promise which will never happen because httpRespond was responsible for resolving it).

The reason this worked up until https://github.com/emberjs/ember.js/pull/4347, was that the router was completely refactored (prior to 1.0.0-rc.6) and the flag that `ember-testing` was previously checking `router.isLoading` was NEVER set so it was always false (and therefore would never wait for the routers transition to resolve). The change made in that PR was a good change, and brought the `wait` helper back inline with what I assume was its intent all along.

---------

OK, all that said, I have a solution, but it isn't API compatible with the prior versions. Basically, we need to have the `visit` AND the `httpRespond` bundled together in a single async helper. This allows us to kick off the router transition, and then handle the canned response before calling `wait` (and only `wait`'ing at the end of both).

This may or may not be an acceptable solution to @trek, but it should work and resolve the issue reported here.