Skip to content

Instantly share code, notes, and snippets.

@alexparker
Created May 11, 2015 20:52
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 alexparker/51b3465f9604452cfd82 to your computer and use it in GitHub Desktop.
Save alexparker/51b3465f9604452cfd82 to your computer and use it in GitHub Desktop.
/* jshint expr:true */
import { expect, should } from 'chai';
import {
describeModel,
it
} from 'ember-mocha';
describeModel(
'order',
'OrderModel',
{ needs: ['model:item', 'model:warning'] },
function() {
// Replace this with your real tests.
it('exists', function() {
var model = this.subject();
// var store = this.store();
expect(model).to.be.ok;
});
describe('CustomerName', function() {
it('combines first and last names', function() {
var order = this.subject({
customerFirstName: 'Joe',
customerLastName: 'Strummer'
});
var customerName = order.get('customerName');
expect(customerName).to.equal('Joe Strummer');
});
});
describe('label', function() {
var order = this.subject({
id: 'ASDF-123456',
customerFirstName: 'Joe'
});
it('returns a customerName if there is one', function() {
expect(order.get('label')).to.equal('Joe');
});
it('returns the id if there is no customerName', function() {
order.set('customerFirstName', null);
order.get('label').should.equal('#ASDF-123456');
});
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment