Last active
December 17, 2015 01:19
-
-
Save jonbca/5527639 to your computer and use it in GitHub Desktop.
Testing Ember with ember-testing and Jasmine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.visitorFor (location) -> (expectations) -> () -> | |
isDone = false | |
visit(location).then -> | |
expectations() | |
isDone = true | |
waitsFor -> isDone | |
window.stop = window.start = Ember.K |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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