public/javascripts/specs/lib/model_spec.js in riojs-0.0.4 vs public/javascripts/specs/lib/model_spec.js in riojs-0.0.5
- old
+ new
@@ -1881,9 +1881,22 @@
(u == user22).shouldBeTrue();
}.shouldBeCalled(), true);
this.modelInstance.setUserId(22);
},
+
+ "by initializing it's foreign key with the assiation id": function() {
+ var user = new rio.models.User({ id: 14 });
+
+ new this.model({ user: user }).getUserId().shouldEqual(14);
+ },
+
+ "by initializing it's custom foreign key with the assiation id": function() {
+ var user = new rio.models.User({ id: 254 });
+ var company = new this.companyModel({ id: 254 });
+
+ new this.model({ company: company }).getEmployerId().shouldEqual(254);
+ },
"by allowing explicitly defined class names": function() {
var user91 = new rio.models.User({ id: 91 });
(this.modelInstance.getPerson() == user91).shouldBeTrue();
\ No newline at end of file