Sha256: 8a2cbd6059d891f540722108e00fcf150ba648d2a76864ce19390fe963ce3b3b

Contents?: true

Size: 870 Bytes

Versions: 1

Compression:

Stored size: 870 Bytes

Contents

module("Model test", {
  setup: function(){
    this.Asset = Model.setup();
  }
});

test("load()", function(){
  var a = this.Asset.inst();
  a.load({
    local: true, 
    name: "test.pdf"
  });
  
  ok(a.local, "Load sets properties");
  equals(a.name, "test.pdf", "load() sets properties (2)");
  
  var b = this.Asset.inst({
    name: "test2.pdf"
  });
  
  equals(b.name, "test2.pdf", "Calls load() on instantiation");
});

test("attributes()", function(){
  this.Asset.attributes = ["name"];

  var a = this.Asset.inst();
  a.name = "test.pdf";
  a.id   = 1;

  same(a.attributes(), {
    name: "test.pdf",
    id: 1
  });
});

test("find()", function(){
  var a = this.Asset.create();
  
  equals(this.Asset.find(a.id).id, a.id, "Returns saved assets");
  
  raises(function(){
    this.Asset.find("non-existant-id");
  }, "Raises when Asset doesn't exist");
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ichabod-0.0.2 examples/qunit/model.test.js