Testing controllers in Ember.js 1.0.0-RC.1

“Who doesn't love living on the edge?” — 23 February 2013

I’m really happy that Ember.js has reached RC1 status. Hopefully the API will be a bit more stable from now on, which is one less thing for the naysayers to argue about!

Upgrading from a previous release caused all of my controller tests to break, which was really annoying. Lots of this error:

TypeError: Cannot call method 'lookup' of null

After some code spelunking, the fix is quite simple; controllers require a container object now:

describe 'MyApp.FooController', ->
  beforeEach ->
    @controller = MyApp.FooController.create
      container: MyApp.__container__

For better or worse, when using Ember the use of Google search by date is still absolutely essential…

Google search settings