extjs-mvc 0.4.0.f → 0.4.0.g
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/bin/extjs-mvc +0 -3
- data/lib/extjs-mvc.rb +10 -6
- data/lib/extjs-mvc/api.rb +0 -1
- metadata +8 -84
- data/lib/src/App.js +0 -219
- data/lib/src/MVC.js +0 -260
- data/lib/src/Presenter.js +0 -52
- data/lib/src/README.rdoc +0 -69
- data/lib/src/controller/Controller.js +0 -278
- data/lib/src/controller/CrudController.js +0 -460
- data/lib/src/lib/Array.js +0 -26
- data/lib/src/lib/Booter.js +0 -416
- data/lib/src/lib/ClassManager.js +0 -191
- data/lib/src/lib/ControllerClassManager.js +0 -95
- data/lib/src/lib/Dependencies.js +0 -44
- data/lib/src/lib/DispatchMatcher.js +0 -98
- data/lib/src/lib/Dispatcher.js +0 -129
- data/lib/src/lib/Environment.js +0 -43
- data/lib/src/lib/Inflector.js +0 -155
- data/lib/src/lib/ModelClassManager.js +0 -19
- data/lib/src/lib/Route.js +0 -139
- data/lib/src/lib/Router.js +0 -282
- data/lib/src/lib/String.js +0 -94
- data/lib/src/lib/ViewClassManager.js +0 -229
- data/lib/src/lib/notes.txt +0 -32
- data/lib/src/model/AdapterManager.js +0 -30
- data/lib/src/model/Association.js +0 -26
- data/lib/src/model/Base.js +0 -63
- data/lib/src/model/BelongsToAssociation.js +0 -116
- data/lib/src/model/Cache.js +0 -131
- data/lib/src/model/HasManyAssociation.js +0 -160
- data/lib/src/model/Model.js +0 -331
- data/lib/src/model/UrlBuilder.js +0 -106
- data/lib/src/model/adapters/AbstractAdapter.js +0 -296
- data/lib/src/model/adapters/MemoryAdapter.js +0 -103
- data/lib/src/model/adapters/RESTAdapter.js +0 -345
- data/lib/src/model/adapters/RESTJSONAdapter.js +0 -68
- data/lib/src/model/adapters/notes.txt +0 -42
- data/lib/src/model/associations/Association.js +0 -192
- data/lib/src/model/associations/notes.txt +0 -87
- data/lib/src/model/validations/Errors.js +0 -136
- data/lib/src/model/validations/Plugin.js +0 -139
- data/lib/src/model/validations/Validations.js +0 -276
- data/lib/src/notes/Charts.graffle +0 -0
- data/lib/src/overrides/Ext.Component.js +0 -21
- data/lib/src/overrides/Ext.extend.js +0 -142
- data/lib/src/spec/Array.spec.js +0 -15
- data/lib/src/spec/ExtMVC.spec.js +0 -65
- data/lib/src/spec/Model.spec.js +0 -370
- data/lib/src/spec/OS.spec.js +0 -83
- data/lib/src/spec/Router.spec.js +0 -99
- data/lib/src/spec/SpecHelper.js +0 -106
- data/lib/src/spec/String.spec.js +0 -83
- data/lib/src/spec/model/AbstractAdapter.spec.js +0 -49
- data/lib/src/spec/model/Associations.spec.js +0 -99
- data/lib/src/spec/model/Cache.spec.js +0 -5
- data/lib/src/spec/model/RESTAdapter.spec.js +0 -19
- data/lib/src/spec/model/ValidationErrors.spec.js +0 -64
- data/lib/src/spec/model/Validations.spec.js +0 -166
- data/lib/src/spec/model/ValidationsPlugin.spec.js +0 -108
- data/lib/src/spec/suite.html +0 -60
- data/lib/src/specs-old/JSSpec.css +0 -216
- data/lib/src/specs-old/JSSpec.js +0 -1512
- data/lib/src/specs-old/all.html +0 -66
- data/lib/src/specs-old/base.js +0 -14
- data/lib/src/specs-old/controller.js +0 -17
- data/lib/src/specs-old/diff_match_patch.js +0 -1
- data/lib/src/specs-old/model.js +0 -70
- data/lib/src/specs-old/route.js +0 -38
- data/lib/src/specs-old/router.js +0 -59
- data/lib/src/specs-old/string.js +0 -22
- data/lib/src/testrunner/JSpecFormatter.js +0 -111
- data/lib/src/testrunner/TestClient.js +0 -181
- data/lib/src/testrunner/TestGrid.js +0 -351
- data/lib/src/testrunner/TestRunner.js +0 -110
- data/lib/src/testrunner/TestViewport.js +0 -94
- data/lib/src/vendor.yml +0 -29
- data/lib/src/vendor/ext-3.1.1/vendor.yml +0 -16
- data/lib/src/view/FormWindow.js +0 -184
- data/lib/src/view/HasManyEditorGridPanel.js +0 -211
- data/lib/src/view/scaffold/Edit.js +0 -46
- data/lib/src/view/scaffold/Index.js +0 -561
- data/lib/src/view/scaffold/New.js +0 -20
- data/lib/src/view/scaffold/ScaffoldFormPanel.js +0 -255
data/lib/src/spec/Router.spec.js
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("The Router", function() {
|
3
|
-
var router;
|
4
|
-
|
5
|
-
before(function() {
|
6
|
-
router = new ExtMVC.Router();
|
7
|
-
});
|
8
|
-
|
9
|
-
describe("connect", function() {
|
10
|
-
// it("should create a new Route", function() {
|
11
|
-
// var routeCreated = false;
|
12
|
-
// ExtMVC.Route = function() {routeCreated = true;};
|
13
|
-
//
|
14
|
-
// router.connect(':controller/:action');
|
15
|
-
// expect(routeCreated).to(equal, true);
|
16
|
-
// });
|
17
|
-
});
|
18
|
-
|
19
|
-
describe("name", function() {
|
20
|
-
before(function() {
|
21
|
-
router.name("myRoute", "myNamespace/:controller/:action");
|
22
|
-
});
|
23
|
-
|
24
|
-
// it("should create a new Route", function() {
|
25
|
-
// var routeCreated = false;
|
26
|
-
//
|
27
|
-
// ExtMVC.Route = ExtMVC.Route.prototype.constructor.createInterceptor(function() {
|
28
|
-
// routeCreated = true;
|
29
|
-
//
|
30
|
-
// return arguments;
|
31
|
-
// }, this);
|
32
|
-
//
|
33
|
-
// router.connect(':controller/:action');
|
34
|
-
// expect(routeCreated).to(equal, true);
|
35
|
-
// });
|
36
|
-
|
37
|
-
it("should make the route accessible as a named route", function() {
|
38
|
-
expect(typeof router.namedRoutes['myRoute']).to_not(equal, "undefined");
|
39
|
-
});
|
40
|
-
});
|
41
|
-
|
42
|
-
describe("root", function() {
|
43
|
-
before(function() {
|
44
|
-
router.root({controller: 'index', action: 'index'});
|
45
|
-
});
|
46
|
-
|
47
|
-
|
48
|
-
});
|
49
|
-
|
50
|
-
describe("recognising url strings", function() {
|
51
|
-
before(function() {
|
52
|
-
router.connect(":controller/:action/:id");
|
53
|
-
router.connect(":controller/:action");
|
54
|
-
});
|
55
|
-
|
56
|
-
it("should recognise :controller/:action/:id", function() {
|
57
|
-
expect(router.recognise("index/index")).to_not(equal, false);
|
58
|
-
});
|
59
|
-
|
60
|
-
it("should return the correct controller", function() {
|
61
|
-
expect(router.recognise("cont/act").controller).to(equal, "cont");
|
62
|
-
});
|
63
|
-
|
64
|
-
it("should return the correct action", function() {
|
65
|
-
expect(router.recognise("cont/act").action).to(equal, "act");
|
66
|
-
});
|
67
|
-
|
68
|
-
it("should return the correct id", function() {
|
69
|
-
expect(router.recognise("cont/act/100").id).to(equal, "100");
|
70
|
-
});
|
71
|
-
|
72
|
-
describe("more complex URLs", function() {
|
73
|
-
before(function() {
|
74
|
-
router.connect("myNamespace/:controller/anotherSegment/:action");
|
75
|
-
});
|
76
|
-
|
77
|
-
it("should recognise URLS with arbitrary text in the matcher", function() {
|
78
|
-
var url = "myNamespace/cont/anotherSegment/act";
|
79
|
-
expect(router.recognise(url).controller).to(equal, "cont");
|
80
|
-
expect(router.recognise(url).action).to(equal, "act");
|
81
|
-
});
|
82
|
-
|
83
|
-
describe("with match conditions", function() {
|
84
|
-
before(function() {
|
85
|
-
router.connect("myNamespace/:controller/:action/:id", {conditions: {':id': "[0-9]+"}});
|
86
|
-
});
|
87
|
-
|
88
|
-
it("should not recognise if the conditions are not met", function() {
|
89
|
-
expect(router.recognise("myNamespace/cont/act/notanumber")).to(equal, false);
|
90
|
-
});
|
91
|
-
|
92
|
-
it("should recognise if the conditions are met", function() {
|
93
|
-
expect(router.recognise("myNamespace/cont/act/150").id).to(equal, 150);
|
94
|
-
});
|
95
|
-
});
|
96
|
-
});
|
97
|
-
});
|
98
|
-
});
|
99
|
-
});
|
data/lib/src/spec/SpecHelper.js
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
Ext.ns('MVCTest', 'MVCTest.models');
|
2
|
-
|
3
|
-
ExtMVC.model.modelNamespace = MVCTest.models;
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @class MVCTest.models.User
|
7
|
-
* @extends ExtMVC.model
|
8
|
-
*/
|
9
|
-
ExtMVC.model.define("User", {
|
10
|
-
fields: [
|
11
|
-
{name: 'id', type: 'int'},
|
12
|
-
{name: 'first_name', type: 'string'},
|
13
|
-
{name: 'last_name', type: 'string'},
|
14
|
-
{name: 'email', type: 'string'}
|
15
|
-
],
|
16
|
-
hasMany: "BlogPost",
|
17
|
-
|
18
|
-
displayName: function() {
|
19
|
-
return String.format("{0} {1}", this.data.first_name, this.data.last_name);
|
20
|
-
},
|
21
|
-
|
22
|
-
//this is used to test instance method inheritance in Model.spec.js
|
23
|
-
earlyJoiner: function() {
|
24
|
-
return this.data.id < 100;
|
25
|
-
},
|
26
|
-
|
27
|
-
classMethods: {
|
28
|
-
testClassMethod: function() {
|
29
|
-
return "A Class Method";
|
30
|
-
},
|
31
|
-
|
32
|
-
//simple class method to test class method overwrites
|
33
|
-
methodToOverwrite: function() {
|
34
|
-
return true;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
});
|
38
|
-
|
39
|
-
/**
|
40
|
-
* @class MVCTest.models.AdminUser
|
41
|
-
* @extends MVCTest.models.User
|
42
|
-
* A subclass of User, defining additional fields
|
43
|
-
*/
|
44
|
-
ExtMVC.model.define("AdminUser", {
|
45
|
-
extend: "User",
|
46
|
-
fields: [
|
47
|
-
{name: 'is_admin', type: 'bool'},
|
48
|
-
{name: 'password', type: 'string'}
|
49
|
-
]
|
50
|
-
});
|
51
|
-
|
52
|
-
/**
|
53
|
-
* @class MVCTest.models.BlogPost
|
54
|
-
* @extends ExtMVC.model
|
55
|
-
*/
|
56
|
-
ExtMVC.model.define("BlogPost", {
|
57
|
-
fields: [
|
58
|
-
{name: 'id', type: 'int'},
|
59
|
-
{name: 'title', type: 'string'},
|
60
|
-
{name: 'content', type: 'string'},
|
61
|
-
{name: 'user_id', type: 'int'}
|
62
|
-
],
|
63
|
-
belongsTo: "User",
|
64
|
-
hasMany: "Comment",
|
65
|
-
|
66
|
-
instanceMethods: {
|
67
|
-
testInstanceMethod: Ext.emptyFn
|
68
|
-
}
|
69
|
-
});
|
70
|
-
|
71
|
-
/**
|
72
|
-
* @class MVCTest.models.Comment
|
73
|
-
* @extends ExtMVC.model
|
74
|
-
*/
|
75
|
-
ExtMVC.model.define("Comment", {
|
76
|
-
fields: [
|
77
|
-
{name: 'id', type: 'int'},
|
78
|
-
{name: 'blog_post_id', type: 'int'},
|
79
|
-
{name: 'content', type: 'string'}
|
80
|
-
],
|
81
|
-
belongsTo: "BlogPost"
|
82
|
-
});
|
83
|
-
|
84
|
-
MVCTest.OS = new ExtMVC.OS({
|
85
|
-
name: "MVCTest"
|
86
|
-
});
|
87
|
-
|
88
|
-
MVCTest.controllers = {};
|
89
|
-
|
90
|
-
/**
|
91
|
-
* @class MVCTest.controllers.IndexController
|
92
|
-
* @extends ExtMVC.Controller
|
93
|
-
* Fake controller for use in OS.spec.js, Controller.spec.js and CrudController.spec.js
|
94
|
-
*/
|
95
|
-
MVCTest.controllers.IndexController = Ext.extend(ExtMVC.Controller, {
|
96
|
-
constructor: function() {
|
97
|
-
//super
|
98
|
-
MVCTest.controllers.IndexController.superclass.constructor.call(this, {
|
99
|
-
viewsPackage: MVCTest.views.index
|
100
|
-
});
|
101
|
-
|
102
|
-
// this.actsAsCrudController(MVCTest.models.User);
|
103
|
-
}
|
104
|
-
});
|
105
|
-
|
106
|
-
Ext.ns('MVCTest.views.index');
|
data/lib/src/spec/String.spec.js
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("String Functions", function() {
|
3
|
-
it('should capitalize a string', function() {
|
4
|
-
expect("user".capitalize()).to(equal, "User");
|
5
|
-
});
|
6
|
-
|
7
|
-
it("should titleize a string", function() {
|
8
|
-
expect("a test sentence".titleize()).to(equal, "A Test Sentence");
|
9
|
-
});
|
10
|
-
|
11
|
-
it("should camelize a string", function() {
|
12
|
-
expect("an_underscored_string".camelize()).to(equal, "AnUnderscoredString");
|
13
|
-
});
|
14
|
-
|
15
|
-
it("should underscore a string", function() {
|
16
|
-
expect("A string with whitespaces".underscore()).to(equal, "a_string_with_whitespaces");
|
17
|
-
});
|
18
|
-
|
19
|
-
it("should underscore a camelized string", function() {
|
20
|
-
expect("ALongTableName".underscore()).to(equal, "a_long_table_name");
|
21
|
-
});
|
22
|
-
|
23
|
-
it("should delegate singularize to Inflector", function() {
|
24
|
-
//stub
|
25
|
-
var singularize_was_called = false;
|
26
|
-
ExtMVC.Inflector.singularize = function() {
|
27
|
-
singularize_was_called = true;
|
28
|
-
};
|
29
|
-
|
30
|
-
"users".singularize();
|
31
|
-
expect(singularize_was_called).to(equal, true);
|
32
|
-
});
|
33
|
-
|
34
|
-
it("should delegate pluralize to Inflector", function() {
|
35
|
-
//stub
|
36
|
-
var pluralize_was_called = false;
|
37
|
-
ExtMVC.Inflector.pluralize = function() {
|
38
|
-
pluralize_was_called = true;
|
39
|
-
};
|
40
|
-
|
41
|
-
"users".pluralize();
|
42
|
-
expect(pluralize_was_called).to(equal, true);
|
43
|
-
});
|
44
|
-
|
45
|
-
describe("toCurrency", function() {
|
46
|
-
var amount = "1234567.89";
|
47
|
-
|
48
|
-
it("should add commas as appropriate", function() {
|
49
|
-
expect(amount.toCurrency("£")).to(equal, "£1,234,567.89");
|
50
|
-
});
|
51
|
-
|
52
|
-
it("should use dollars by default", function() {
|
53
|
-
expect(amount.toCurrency()).to(equal, "$1,234,567.89");
|
54
|
-
});
|
55
|
-
});
|
56
|
-
|
57
|
-
describe("escaping HTML", function() {
|
58
|
-
var html = '<span>"fish & chips"</span>';
|
59
|
-
var escaped = html.escapeHTML();
|
60
|
-
|
61
|
-
it("should escape left angle brackets", function() {
|
62
|
-
expect(escaped).to_not(match, /</);
|
63
|
-
});
|
64
|
-
|
65
|
-
it("should escape right angle brackets", function() {
|
66
|
-
expect(escaped).to_not(match, />/);
|
67
|
-
});
|
68
|
-
|
69
|
-
it("should escape double-quotes", function() {
|
70
|
-
expect(escaped).to_not(match, /\"/);
|
71
|
-
});
|
72
|
-
|
73
|
-
it("should escape ampersands", function() {
|
74
|
-
expect(escaped).to(match, /(&[^a]|&[^a][^m]|&[^a][^m][^p]|&[^a][^m][^p][^;])/);
|
75
|
-
});
|
76
|
-
|
77
|
-
it("should escape a string correctly", function() {
|
78
|
-
expect(escaped).to(equal, "<span>"fish & chips"</span>");
|
79
|
-
});
|
80
|
-
});
|
81
|
-
|
82
|
-
});
|
83
|
-
});
|
@@ -1,49 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("The Abstract Adapter", function() {
|
3
|
-
var ns = ExtMVC.Model.modelNamespace;
|
4
|
-
|
5
|
-
describe("instance methods", function() {
|
6
|
-
it("should add instance methods to Ext.data.Record's prototype", function() {
|
7
|
-
var p = Ext.data.Record.prototype;
|
8
|
-
|
9
|
-
Ext.each(['save', 'destroy', 'update'], function(methodName) {
|
10
|
-
expect(typeof p[methodName]).to(equal, 'function');
|
11
|
-
}, this);
|
12
|
-
});
|
13
|
-
|
14
|
-
describe("the save method", function() {
|
15
|
-
|
16
|
-
});
|
17
|
-
});
|
18
|
-
|
19
|
-
describe("class methods", function() {
|
20
|
-
it("should add class methods to each model class", function() {
|
21
|
-
Ext.each(['create', 'build', 'find', 'destroy'], function(methodName) {
|
22
|
-
for (var model in ns) {
|
23
|
-
expect(typeof ns[model][methodName]).to(equal, 'function');
|
24
|
-
}
|
25
|
-
}, this);
|
26
|
-
});
|
27
|
-
});
|
28
|
-
|
29
|
-
describe("hasMany association methods", function() {
|
30
|
-
it("should add the correct methods to the hasMany prototype", function() {
|
31
|
-
var p = ExtMVC.Model.plugin.association.HasMany.prototype;
|
32
|
-
|
33
|
-
Ext.each(['create', 'build', 'find', 'destroy'], function(methodName) {
|
34
|
-
expect(typeof p[methodName]).to(equal, 'function');
|
35
|
-
}, this);
|
36
|
-
});
|
37
|
-
});
|
38
|
-
|
39
|
-
describe("belongsTo association methods", function() {
|
40
|
-
it("should add the correct methods to the hasMany prototype", function() {
|
41
|
-
var p = ExtMVC.Model.plugin.association.HasMany.prototype;
|
42
|
-
|
43
|
-
Ext.each(['find', 'destroy'], function(methodName) {
|
44
|
-
expect(typeof p[methodName]).to(equal, 'function');
|
45
|
-
}, this);
|
46
|
-
});
|
47
|
-
});
|
48
|
-
});
|
49
|
-
});
|
@@ -1,99 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
//keep track of the object to which models are currently assigned
|
3
|
-
var ns = ExtMVC.Model.modelNamespace;
|
4
|
-
|
5
|
-
describe("Associations", function() {
|
6
|
-
ExtMVC.Model.define("AssocUser", {
|
7
|
-
fields: [],
|
8
|
-
hasMany: "AssocPost"
|
9
|
-
});
|
10
|
-
|
11
|
-
ExtMVC.Model.define("AssocPost", {
|
12
|
-
fields: [],
|
13
|
-
hasMany: "AssocComment",
|
14
|
-
belongsTo: "AssocUser"
|
15
|
-
});
|
16
|
-
|
17
|
-
ExtMVC.Model.define("AssocComment", {
|
18
|
-
fields: [],
|
19
|
-
belongsTo: {
|
20
|
-
associatedClass: "AssocPost",
|
21
|
-
associationName: 'posts',
|
22
|
-
extend: {
|
23
|
-
myMethod: function() {}
|
24
|
-
}
|
25
|
-
}
|
26
|
-
});
|
27
|
-
|
28
|
-
describe("The Associations plugin", function() {
|
29
|
-
var associations = ExtMVC.Model.plugin.association,
|
30
|
-
model = ns.AssocPost,
|
31
|
-
commentModel = ns.AssocComment;
|
32
|
-
|
33
|
-
it("should add a hasMany relationship where defined", function() {
|
34
|
-
expect(model.prototype.AssocComments instanceof associations.HasMany).to(equal, true);
|
35
|
-
});
|
36
|
-
|
37
|
-
it("should add a belongsTo relationship where defined", function() {
|
38
|
-
expect(model.prototype.AssocUser instanceof associations.BelongsTo).to(equal, true);
|
39
|
-
});
|
40
|
-
|
41
|
-
it("should allow customisation of association names", function() {
|
42
|
-
expect(commentModel.prototype.posts instanceof associations.BelongsTo).to(equal, true);
|
43
|
-
});
|
44
|
-
});
|
45
|
-
|
46
|
-
describe("A Base association", function() {
|
47
|
-
/**
|
48
|
-
* Create an association between BlogPost and User.
|
49
|
-
* In practice we never actually instantiate Base associations as they don't
|
50
|
-
* do very much, instead use a subclass such as HasMany or BelongsTo
|
51
|
-
*/
|
52
|
-
var assoc = new ExtMVC.Model.plugin.association.Base(ns.BlogPost, ns.User, {
|
53
|
-
extend: {
|
54
|
-
myProperty: 'property',
|
55
|
-
myFunction: function() { return 'result'; }
|
56
|
-
}
|
57
|
-
});
|
58
|
-
|
59
|
-
it("should maintain a reference to its owner class", function() {
|
60
|
-
expect(assoc.ownerClass).to(equal, ns.BlogPost);
|
61
|
-
});
|
62
|
-
|
63
|
-
it("should maintain a reference to its associated class", function() {
|
64
|
-
expect(assoc.associatedClass).to(equal, ns.User);
|
65
|
-
});
|
66
|
-
|
67
|
-
it("should add extension properties to the association", function() {
|
68
|
-
expect(assoc.myProperty).to(equal, 'property');
|
69
|
-
expect(assoc.myFunction()).to(equal, 'result');
|
70
|
-
});
|
71
|
-
});
|
72
|
-
|
73
|
-
describe("A BelongsTo association", function() {
|
74
|
-
//blog post belongs to user
|
75
|
-
var assoc = new ExtMVC.Model.plugin.association.BelongsTo(ns.BlogPost, ns.User);
|
76
|
-
|
77
|
-
it("should set a default association name", function() {
|
78
|
-
expect(assoc.name).to(equal, 'user');
|
79
|
-
});
|
80
|
-
|
81
|
-
it("should set a default foreign key", function() {
|
82
|
-
expect(assoc.foreignKey).to(equal, 'user_id');
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
describe("A HasMany association", function() {
|
87
|
-
//user has many blog posts
|
88
|
-
var assoc = new ExtMVC.Model.plugin.association.HasMany(ns.User, ns.BlogPost);
|
89
|
-
|
90
|
-
it("should set a default association name", function() {
|
91
|
-
expect(assoc.name).to(equal, 'blog_posts');
|
92
|
-
});
|
93
|
-
|
94
|
-
it("should set a default foreign key", function() {
|
95
|
-
expect(assoc.foreignKey).to(equal, 'user_id');
|
96
|
-
});
|
97
|
-
});
|
98
|
-
});
|
99
|
-
});
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Screw.Unit(function() {
|
2
|
-
describe("The REST adapter", function() {
|
3
|
-
var ns = ExtMVC.Model.modelNamespace;
|
4
|
-
|
5
|
-
var rest = new ExtMVC.Model.plugin.adapter.RESTAdapter(),
|
6
|
-
savedInst = new ns.User({title: 'Ed', id: 100}),
|
7
|
-
newInst = new ns.User({title: 'Nick'});
|
8
|
-
|
9
|
-
describe("the instanceUrl method", function() {
|
10
|
-
it("should return a url including the ID if the primary key is set", function() {
|
11
|
-
expect(rest.instanceUrl(savedInst)).to(equal, '/users/100');
|
12
|
-
});
|
13
|
-
|
14
|
-
it("should return a generic url for this model if the primary key is not set", function() {
|
15
|
-
expect(rest.instanceUrl(newInst)).to(equal, '/users');
|
16
|
-
});
|
17
|
-
});
|
18
|
-
});
|
19
|
-
});
|