Last active
December 23, 2015 19:09
-
-
Save kurko/6680239 to your computer and use it in GitHub Desktop.
Testing Ember models in a Rails app with QUnit
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
//= require admin/application | |
module("Model/Campaign"); | |
test("simple test now", function() { | |
expect(1); | |
var store = Admin.__container__.lookup("store:main"), | |
campaign = store.createRecord('campaign', {id: 1}), | |
ad1 = store.createRecord('ad', {name: 'ad 1'}), | |
ad2 = store.createRecord('ad', {name: 'ad 2'}), | |
ad3 = store.createRecord('ad', {name: 'ad 3'}); | |
stop(); | |
Ember.RSVP.all([campaign, ad1, ad2, ad3]).then(function() { | |
// without this, next block doesn't work | |
return campaign.get('ads'); | |
}).then(function() { | |
return campaign.get('ads').pushObject(adGroup2); | |
}).then(function() { | |
campaign.get('ads').forEach(function(template) { | |
equal(template.get('name'), 'group 2'); // green | |
}); | |
}); | |
start(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment