emberjs/ember.js — pull request #3333 by marshallshen (2013-09-04 14:16:38+00:00)
Title: [Fail at async, please advise ] Add assertion test

Hi:

Add an assertion test for Ember.assert when model is not defined for route with dynamic segment.

Although this test passes, it pollutes other async integration tests in `basic-test`:

> Uncaught TypeError: Cannot call method 'find' of undefined
Source:
http://localhost:9292/?package=ember:352

I believe the cause of the error are:
* Even though `Ember.assert` is triggered, the flow continues to `return modelClass.find(value)` with modelClass is nil.
* store computed property didn't return right away.

Please advise how to tackle the test pollution? Much appreciated!

Below is what I'm trying to test:
`````
store: Ember.computed(function(){
var container = this.container;
var routeName = this.routeName;
var namespace = get(this, 'router.namespace');

return {
find: function(name, value) {
var modelClass = container.lookupFactory('model:' + name);

Ember.assert("You used the dynamic segment " + name + "_id in your route "+ routeName + ", but " + namespace + "." + classify(name) + " did not exist and you did not override your route's `model` hook.", modelClass);

return modelClass.find(value);
}
};
`````