Example #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);
  });
Example #2
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 });
    });
Example #3
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 });
 });
Example #4
0
 it('can register a factory', function() {
   chai.factory('user', { foo: 3, bar: true });
   chai.create('user').should.eql({ foo: 3, bar: true });
 });