Skip to content

Instantly share code, notes, and snippets.

@jonbca
Last active December 17, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbca/5527639 to your computer and use it in GitHub Desktop.
Save jonbca/5527639 to your computer and use it in GitHub Desktop.
Testing Ember with ember-testing and Jasmine
Ember.testing = true
App = Ember.Application.create()
App.setupForTesting()
App.injectTestHelpers()
App.Store = DS.Store.extend
revision: 12
adapter: 'DS.FixtureAdapter'
App.People = DS.Model.extend
name: DS.attr('string')
App.People.FIXTURES = [{id: 1, name: 'Juan'}]
Ember.run App, App.advanceReadiness
window.visitorFor (location) -> (expectations) -> () ->
isDone = false
visit(location).then ->
expectations()
isDone = true
waitsFor -> isDone
window.stop = window.start = Ember.K
describe 'people', ->
checksPeopleVisit = visitorFor '/people'
beforeEach ->
App.People.FIXTURES = [{id: 1, name: 'Juan'}]
App.reset()
Ember.run App, App.advanceReadiness
it "checks there is a list of people on the page", checksPeopleVisit ->
expect($('li')).not.toBeFalsy
# etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment