it('can create independant factories', function() { chai.factory('user', { foo: 3, bar: true }); var first = chai.create('user'); var second = chai.create('user'); first.foo = 5; second.foo.should.eql(3); });
beforeEach(function(done) { language = new Language( chai.create('language') ); done(); });
it('is extendable', function() { var factory = chai.factory('user', { foo: 3, bar: true }); chai.factory('admin', factory.extend({ bar: false })); chai.create('admin').should.eql({ foo: 3, bar: false }); });
(function() { chai.create('unregistered'); }).should.throw();
it('can overwrite properties when creating factories', function() { chai.factory('user', { foo: 3, bar: true }); chai.create('user', { foo: 4 }).should.eql({ foo: 4, bar: true }); });
it('can register a factory', function() { chai.factory('user', { foo: 3, bar: true }); chai.create('user').should.eql({ foo: 3, bar: true }); });