Exemplo n.º 1
0
  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);
  });
Exemplo n.º 2
0
 beforeEach(function(done) {
     language = new Language( chai.create('language') );
     done();
 });
Exemplo n.º 3
0
    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 });
    });
Exemplo n.º 4
0
 (function() {
   chai.create('unregistered');
 }).should.throw();
Exemplo n.º 5
0
 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 });
 });
Exemplo n.º 6
0
 it('can register a factory', function() {
   chai.factory('user', { foo: 3, bar: true });
   chai.create('user').should.eql({ foo: 3, bar: true });
 });