Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unit tests for passing in extra URL options

  • Loading branch information...
commit ec66240a7ed19f0a7b46e138408b3a703b75660c 1 parent e9f2d78
@nbudin nbudin authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 test/jester_test.html
View
25 test/jester_test.html
@@ -262,6 +262,14 @@
assertEquals("1", eric.admin.toString());
assert_changed();
});
+
+ // with default params
+ Resource.model("User", {defaultParams: {lite: true}});
+ ericLite = User.find(1);
+ assertEquals("eric", ericLite.first_name);
+ assertEquals(1, ericLite.id); // make sure ID gets autoset
+ assertEquals(2, ericLite._properties.length);
+ assert(typeof(ericLite.admin) == "undefined");
}
function testFindAll() {
@@ -526,6 +534,23 @@
});
}
+function testSaveWithExtraParams() {
+ var eric = User.build({ 'id' : '1', 'first_name' : 'eric' });
+ assert(! eric.new_record());
+
+ Ajax = { Request : function (url, options) {
+ assert(url.include("extraOption=blah"));
+ this.transport = { status : 200 };
+ }};
+
+ assert(eric.save({extraOption: "blah"}));
+
+ eric.save({extraOption: "blah"}, function(saved) {
+ assert(saved);
+ assert_changed();
+ });
+}
+
function testSaveReloadsUponFullResponse() {
// new record
var john = User.build({'first_name' : 'john' });
Please sign in to comment.
Something went wrong with that request. Please try again.