 define [
   'jquery'
+  'chaplin/mediator'
   'chaplin/views/view'
   'chaplin/models/model'
   'chaplin/models/collection'
-], ($, View, Model, Collection) ->
+], ($, mediator, View, Model, Collection) ->
   'use strict'
 
   describe 'View', ->

      model.set foo: 'bar'
      expect(input.val()).toBe 'bar'

    it 'should add an return subviews', ->
      expect(typeof view.subview).toBe 'function'

      subview = new View
      view.subview 'fooSubview', subview
      expect(view.subview 'fooSubview').toBe subview
      expect(view.subviews.length).toBe 1

      subview2 = new View
      view.subview 'fooSubview', subview2
      expect(view.subview 'fooSubview').toBe subview2
      expect(view.subviews.length).toBe 1

    it 'should remove subviews', ->
      subview = new View
      view.subview 'fooSubview', subview
      expect(typeof view.removeSubview).toBe 'function'
      view.removeSubview 'fooSubview'
      expect(typeof view.subview('fooSubview')).toBe 'undefined'

    it 'should render a template', ->

    it 'should pass serialized attributes to the templating function', ->

    it 'should dispose itself correctly', ->
      view.dispose()
      expect(view.disposed).toBe true

      # To test:
      # Dispose subviews
      # Unbind handlers of global events
      # Unbind all model handlers
      # Remove all event handlers on this module
      # Remove the topmost element from DOM
      # Remove element references, options, model/collection references and subview lists
      # Freezing

    it 'should dispose itself when the model or collection is disposed', ->
      model = new Model
      view = new TestView model: model
      spyOn view, 'dispose'
      model.dispose()
      expect(model.disposed).toBe true
      expect(view.disposed).toBe true

      spy = jasmine.createSpy()
      view.modelBind 'add', spy
      view.modelUnbind 'add', spy
      collection.push new Model()
      expect(spy).not.toHaveBeenCalled()

    it 'should force the context of model event handlers', ->
