Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.