Skip to content

Instantly share code, notes, and snippets.

@noelrappin
Created October 14, 2014 19:13
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 noelrappin/bdfdf8fbc71fac7202b3 to your computer and use it in GitHub Desktop.
Save noelrappin/bdfdf8fbc71fac7202b3 to your computer and use it in GitHub Desktop.
Ember controller test with model
import {
moduleFor,
test
} from 'ember-qunit';
import Ember from 'ember';
import startApp from '../../../../helpers/start-app';
var App;
var store;
moduleFor('controller:admin/companies/index', 'AdminCompaniesIndexController', {
// Specify the other units that are required for this test.
needs: ['model:company'],
setup: function() {
App = startApp();
store = App.__container__.lookup("store:main");
},
teardown: function() {
Ember.run(App, 'destroy');
}
});
test('without a filter all companies are returned', function() {
var controller = this.subject();
Ember.run(function() {
var company_1 = store.createRecord("company", {name: "Apple"});
var company_2 = store.createRecord("company", {name: "Orange"});
controller.set("model", [company_1, company_2]);
});
equal(controller.get("filteredModel"), controller.get("model"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment