More cleanup between tests to avoid Metamorph errors

It seems that store is not automatically cleaned when calling
app.destroy() as this is just regular property on app object.
Furthermore, there is a bug with connectOutlet that prevents cleaning
views that are set with it. I've added a small hack to save all the
views added as outlets to be able to clean them after running tests.
This commit is contained in:
Piotr Sarnacki 2012-07-30 14:53:40 +02:00
parent 4a15ccde32
commit 05ee9938a9
2 changed files with 20 additions and 1 deletions

View File

@ -13,6 +13,19 @@ Travis.reopen
@connectOutlet(outletName: 'top', controller: @topController, viewClass: Travis.TopView) @connectOutlet(outletName: 'top', controller: @topController, viewClass: Travis.TopView)
@topController.set('tab', @get('name')) @topController.set('tab', @get('name'))
connectOutlet: ->
view = @_super.apply(this, arguments)
if view
_connectedOutletViews = Travis.app.get('_connectedOutletViews')
unless _connectedOutletViews
_connectedOutletViews = []
_connectedOutletViews.pushObject(view)
Travis.app.set('_connectedOutletViews', _connectedOutletViews)
view
# TopController: Em.Controller.extend # TopController: Em.Controller.extend
# userBinding: 'Travis.app.currentUser' # userBinding: 'Travis.app.currentUser'

View File

@ -2,7 +2,13 @@ minispade.require 'app'
@reset = -> @reset = ->
Em.run -> Em.run ->
Travis.app.destroy() if Travis.app if Travis.app
if Travis.app.store
Travis.app.store.destroy()
if views = Travis.app.get('_connectedOutletViews')
views.forEach (v) -> v.destroy()
Travis.app.destroy()
waits(500) # TODO not sure what we need to wait for here waits(500) # TODO not sure what we need to wait for here
$('#content').remove() $('#content').remove()
$('body').append('<div id="content"></div>') $('body').append('<div id="content"></div>')