Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Finally tracked down that testing bug.

git-svn-id: https://svn.thoughtbot.com/jester/trunk@109 d7758119-aa2c-0410-afcd-b700fbd0d0b3
  • Loading branch information...
commit 1fe5406d7f220c41127cbcf47997233e92f51119 1 parent 6162024
authored October 09, 2007

Showing 1 changed file with 37 additions and 35 deletions. Show diff stats Hide diff stats

  1. 72  test/jester_test.html
72  test/jester_test.html
@@ -93,6 +93,41 @@
93 93
     'created_at' : { '@type' : 'datetime' }
94 94
   }
95 95
   
  96
+  Resource.requestAndParse = function (format, callback, url, options, user_callback, remote) {
  97
+    if (remote && format == "json") {
  98
+      jesterCallback = function(json){
  99
+        result = callback(json);
  100
+        if (user_callback && typeof(user_callback) == "function") {
  101
+          changed = true;
  102
+          user_callback(result);
  103
+        }
  104
+      }
  105
+      eval('var result = ' + Internet[url]);
  106
+      return result;
  107
+    }
  108
+  
  109
+    var result = Internet[url];
  110
+
  111
+    if (format == "json")
  112
+      eval('result = ' + result);
  113
+      
  114
+    if (callback)
  115
+      result = callback(result);
  116
+      
  117
+    if (user_callback) {
  118
+      changed = true;
  119
+      if (typeof(user_callback) == "function")
  120
+        result = user_callback(result);
  121
+      else {
  122
+        user_callback = user_callback.on200 || user_callback.onComplete;
  123
+        if (user_callback)
  124
+          result = user_callback(result);
  125
+      }
  126
+    }
  127
+    
  128
+    return result;
  129
+  }
  130
+  
96 131
   // JSON callback
97 132
   jesterCallback = null;
98 133
   
@@ -118,7 +153,7 @@
118 153
   // Path prefixed models
119 154
   Resource.model("Post", {prefix: "/users/:user_id"})
120 155
   
121  
-  Internet[Post._show_url(1, {user_id: 1})] = {'post': postDetails1};
  156
+  Internet[Post._show_url({id: 1, user_id: 1})] = {'post': postDetails1};
122 157
   
123 158
   // XML models
124 159
   Resource.model("User")
@@ -142,40 +177,7 @@
142 177
   changed = false;
143 178
   assert_changed = function() {assert(changed); changed = false;}
144 179
   
145  
-  Resource.requestAndParse = function (format, callback, url, options, user_callback, remote) {
146  
-    if (remote && format == "json") {
147  
-      jesterCallback = function(json){
148  
-        result = callback(json);
149  
-        if (user_callback && typeof(user_callback) == "function") {
150  
-          changed = true;
151  
-          user_callback(result);
152  
-        }
153  
-      }
154  
-      eval('var result = ' + Internet[url]);
155  
-      return result;
156  
-    }
157  
-  
158  
-    var result = Internet[url];
159  
-    
160  
-    if (format == "json")
161  
-      eval('result = ' + result);
162  
-      
163  
-    if (callback)
164  
-      result = callback(result);
165  
-      
166  
-    if (user_callback) {
167  
-      changed = true;
168  
-      if (typeof(user_callback) == "function")
169  
-        result = user_callback(result);
170  
-      else {
171  
-        user_callback = user_callback.on200 || user_callback.onComplete;
172  
-        if (user_callback)
173  
-          result = user_callback(result);
174  
-      }
175  
-    }
176  
-    
177  
-    return result;
178  
-  }
  180
+  return true;
179 181
 }
180 182
 
181 183
 

0 notes on commit 1fe5406

Please sign in to comment.
Something went wrong with that request. Please try again.