Simple controller test


Alright, so I am trying to follow along with the ember online documentation and doing something I think is very simple:

                // grab an instance of 'ApplicationController'
                var ctrl = window.App.ApplicationController.create();
                // wrap the test in the run loop because we are dealing with async functions
       () {
                    // set a generic model on the post controller
                    ctrl.set('model', sampleJsonObject);

                    var canEdit = ctrl.get('canEdit');



Unfortunately the second call to variable ctrl which is a get fails: error ==> TypeError: Object doesn’t support property or method ‘get’

What am I doing wrong?


Here it should be as follows:

// grab an instance of 'ApplicationController'
var ctrl = this.subject();

This would solve your issue.