Skip to content

Commit

Permalink
hasOne tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fractallian committed Apr 8, 2014
1 parent 5396f2a commit 44e0472
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion graviton.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ Model.prototype.get = function(key) {

Model.prototype.set = function(key, value) {
return Model.setProperty(this.attributes, key, value);
return this;
};

Model.prototype.plain = function() {
Expand Down
11 changes: 10 additions & 1 deletion test/graviton-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,19 @@ Wheel = Model.define("wheels", {
klass: 'cars',
field: 'carId'
}
},
hasOne: {
rim: {
klass: 'rims',
foreignKey: 'wheelId'
}
}
});
init(Wheel);

Rim = Model.define("rims", {});
init(Rim);

Driver = Model.define("drivers", {
hasMany: {
cars: {
Expand Down Expand Up @@ -174,4 +183,4 @@ Tinytest.add('Relations - embedsMany', function(test) {
test.equal(c.windows.all().length, 4);
test.equal(c.windows.at(2).get("type"), "frontPassenger");
test.equal(c.get("windows").length, 4);
});
});

0 comments on commit 44e0472

Please sign in to comment.