Sha256: d1eaac99136cfd5e8aec15d8a84e3b2f1829a48616417ca0af1a8b5f13d58b5a

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

var root;

root = typeof exports !== "undefined" && exports !== null ? exports : window;

require('indemma/lib/record/persistable.js');

describe('persistable', function() {
  return describe('model', function() {
    it('should set the persistable key', function() {
      return model.should.have.property('persistable', true);
    });
    return describe('#find', function() {
      beforeEach(function() {
        this.xhr = jQuery.Deferred();
        sinon.stub(jQuery, "ajax").returns(this.xhr);
        this.personable = model.call({
          resource: 'person',
          has_many: 'friends',
          belongs_to: 'corporation'
        });
        this.arthur = this.personable({
          name: 'Arthur Philip Dent'
        });
        this.xhr.resolveWith(this.arthur, [
          {
            _id: 1
          }
        ]);
        return this.arthur.dirty = true;
      });
      afterEach(function() {
        return jQuery.ajax.restore();
      });
      return it('should try to store a record after saving when initialzed without id', function(done) {
        var _this = this;

        sinon.stub(this.personable.storage, 'store').returns(true);
        this.arthur.save(function() {
          expect(_this.personable.storage.store.calledOnce).to.be["true"];
          return done();
        });
        return this.personable.storage.store.restore();
      });
    });
  });
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/indemma/master/spec/record/persistable_spec.js
ende-0.5.21 components/indefinido/indemma/master/spec/record/persistable_spec.js