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 CHANGED
@@ -27,7 +27,7 @@ begin
27
27
  require 'jeweler'
28
28
  Jeweler::Tasks.new do |s|
29
29
  s.name = "eyeballs"
30
- s.version = "0.5.12"
30
+ s.version = "0.5.12.1"
31
31
  s.author = "Paul Campbell"
32
32
  s.email = "paul@rslw.com"
33
33
  s.homepage = "http://www.github.com/paulca/eyeballs.js"
data/app.rb CHANGED
@@ -7,6 +7,11 @@ get '/reviews' do
7
7
  '[{"id": "1", "title":"Local, baby"}]'
8
8
  end
9
9
 
10
+ get '/reviews_with_content_type' do
11
+ content_type 'application/json'
12
+ '[{"id": "1", "title":"Local, baby"}]'
13
+ end
14
+
10
15
  post '/reviews' do
11
16
  '{"id": "1"}'
12
17
  end
@@ -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-03}
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('/' + model.table_name, function(response){
19
- var documents = JSON.parse(response);
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
  },
@@ -155,7 +155,10 @@ o_O.model = {
155
155
  all: function(callback){
156
156
  if(this.adapter)
157
157
  {
158
- return this.adapter.all(this, callback);
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){
@@ -1,3 +1,3 @@
1
- o_O('<%= name.capitalize %>', function(<%= name.downcase %>){
1
+ o_O('<%= name.capitalize %>', function(){
2
2
 
3
3
  })
@@ -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(){
@@ -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: 19
4
+ hash: 85
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 12
10
- version: 0.5.12
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-03 00:00:00 +00:00
19
+ date: 2010-11-07 00:00:00 +00:00
19
20
  default_executable: eyeballs
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency