travis-web/assets/javascripts/spec/spec_helper.coffee
Piotr Sarnacki 05ee9938a9 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.
2012-07-30 14:53:40 +02:00

26 lines
600 B
CoffeeScript

minispade.require 'app'
@reset = ->
Em.run ->
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
$('#content').remove()
$('body').append('<div id="content"></div>')
@app = (url) ->
reset()
Em.run ->
Travis.run(rootElement: $('#content'))
Em.routes.set('location', url)
_Date = Date
@Date = (date) ->
new _Date(date || '2012-07-02T00:03:00Z')
@Date.UTC = _Date.UTC