Skip to content

Instantly share code, notes, and snippets.

@fivetanley
Created May 11, 2012 20:46
Show Gist options
  • Save fivetanley/2662314 to your computer and use it in GitHub Desktop.
Save fivetanley/2662314 to your computer and use it in GitHub Desktop.
Mocha test
if (typeof define !== 'function'){
var define = require('amdefine')(module);
}
define(['../lib/models/User'], function(User){
'use strict';
var given = describe;
describe('User', function(){
var user;
beforeEach(function(){
user = new User();
});
describe('id', function(){
var id;
beforeEach(function(){
id = user.get('id');
});
it('is a number', function(){
id.should.be.a('number');
});
});
describe('name', function(){
var name;
beforeEach(function(){
name = user.get('name');
});
it('is a property', function(){
name.should.be.a('string');
});
it('is empty by default', function(){
name.should.have.lengthOf(0);
});
});
describe('email', function(){
var email;
beforeEach(function (){
email = user.get('email');
});
it ('is a property of User', function(){
email.should.be.a('string');
});
it('is empty by default', function(){
email.should.have.lengthOf(0);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment