eyeballs 0.5.12 → 0.5.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/app.rb +5 -0
- data/eyeballs.gemspec +2 -2
- data/src/drivers/jquery/adapters/o_O.rest.js +11 -4
- data/src/modules/o_O.model.js +4 -1
- data/templates/model.js +1 -1
- data/test/unit/test_model_with_callbacks.html +15 -0
- data/test/unit/test_rest.html +14 -0
- metadata +4 -3
data/Rakefile
CHANGED
data/app.rb
CHANGED
data/eyeballs.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{eyeballs}
|
8
|
-
s.version = "0.5.12"
|
8
|
+
s.version = "0.5.12.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paul Campbell"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-07}
|
13
13
|
s.default_executable = %q{eyeballs}
|
14
14
|
s.email = %q{paul@rslw.com}
|
15
15
|
s.executables = ["eyeballs"]
|
@@ -14,12 +14,19 @@ o_O.rest = {
|
|
14
14
|
return '/' + object.table_name;
|
15
15
|
}
|
16
16
|
},
|
17
|
-
all: function(model, callback){
|
18
|
-
$.get(
|
19
|
-
var documents
|
17
|
+
all: function(model, callback, original_callback){
|
18
|
+
$.get(this.figure_url(original_callback, model), function(response){
|
19
|
+
var documents;
|
20
|
+
try {
|
21
|
+
documents = JSON.parse(response);
|
22
|
+
}
|
23
|
+
catch(e){
|
24
|
+
documents = response
|
25
|
+
}
|
26
|
+
|
20
27
|
if(typeof callback === 'function')
|
21
28
|
{
|
22
|
-
callback(documents);
|
29
|
+
callback(documents, response);
|
23
30
|
}
|
24
31
|
})
|
25
32
|
},
|
data/src/modules/o_O.model.js
CHANGED
@@ -155,7 +155,10 @@ o_O.model = {
|
|
155
155
|
all: function(callback){
|
156
156
|
if(this.adapter)
|
157
157
|
{
|
158
|
-
|
158
|
+
run_callback(callback, 'loading');
|
159
|
+
return this.adapter.all(this, function(returned_object, response){
|
160
|
+
run_callback(callback, 'success', returned_object, response);
|
161
|
+
}, callback);
|
159
162
|
}
|
160
163
|
},
|
161
164
|
initialize: function(attributes){
|
data/templates/model.js
CHANGED
@@ -36,6 +36,21 @@
|
|
36
36
|
|
37
37
|
module("Models");
|
38
38
|
|
39
|
+
asyncTest('all() with callbacks',2, function(){
|
40
|
+
Review.all({
|
41
|
+
loading: function(){
|
42
|
+
ok('this should be called')
|
43
|
+
},
|
44
|
+
success: function(){
|
45
|
+
ok('this should be called');
|
46
|
+
start();
|
47
|
+
},
|
48
|
+
failure: function(){
|
49
|
+
ok(false, 'this should not be called');
|
50
|
+
}
|
51
|
+
})
|
52
|
+
});
|
53
|
+
|
39
54
|
asyncTest('find() an existent object',2, function(){
|
40
55
|
Review.find('thing', {
|
41
56
|
loading: function(){
|
data/test/unit/test_rest.html
CHANGED
@@ -178,6 +178,20 @@
|
|
178
178
|
});
|
179
179
|
})
|
180
180
|
|
181
|
+
asyncTest('getting all with content type', 2, function(){
|
182
|
+
var review = Review.initialize({title: 'Local, baby'});
|
183
|
+
review.save(function(saved_review){
|
184
|
+
Review.all({
|
185
|
+
url: '/reviews_with_content_type',
|
186
|
+
success: function(documents){
|
187
|
+
equals(documents[0].title, 'Local, baby', 'It should pull in everything')
|
188
|
+
equals(documents[0].id, '1', 'It should persist the id')
|
189
|
+
start();
|
190
|
+
}
|
191
|
+
})
|
192
|
+
});
|
193
|
+
})
|
194
|
+
|
181
195
|
asyncTest('setting new_record attribute', 2, function(){
|
182
196
|
var review = Review.initialize()
|
183
197
|
equals(review.new_record, true, 'should be a new record review');
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyeballs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 85
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
9
|
- 12
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 0.5.12.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Paul Campbell
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-11-
|
19
|
+
date: 2010-11-07 00:00:00 +00:00
|
19
20
|
default_executable: eyeballs
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|