slender_data 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/app/assets/javascripts/slender_data/entry_store.coffee +10 -10
  4. data/app/assets/javascripts/slender_data/loading_tracker.coffee +62 -47
  5. data/app/assets/javascripts/slender_data/persistence_manager.coffee +43 -18
  6. data/app/assets/javascripts/slender_data/queries/single_query.coffee +1 -1
  7. data/lib/slender_data/version.rb +1 -1
  8. data/spec/dummy/log/test.log +29 -826
  9. data/spec/dummy/spec/javascripts/brest_loader_spec.coffee +12 -25
  10. data/spec/dummy/spec/javascripts/entry_store_spec.coffee +52 -25
  11. data/spec/dummy/spec/javascripts/loading_tracker_spec.coffee +120 -89
  12. data/spec/dummy/spec/javascripts/parameterizable_spec.coffee +2 -2
  13. data/spec/dummy/spec/javascripts/persistence_manager_spec.coffee +174 -69
  14. data/spec/dummy/spec/javascripts/queries/multi_query_spec.coffee +6 -6
  15. data/spec/dummy/spec/javascripts/queries/single_query_spec.coffee +0 -10
  16. data/spec/dummy/spec/javascripts/query_cache_spec.coffee +11 -19
  17. data/spec/dummy/spec/javascripts/spec_helper.coffee +27 -0
  18. data/spec/dummy/spec/javascripts/underscore.js +6 -0
  19. data/spec/dummy/tmp/cache/assets/test/sprockets/124f6816f926ae28ad20cc56425f3c91 +0 -0
  20. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/12ce2414098e368903aeb9923e275ef7 +0 -0
  21. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  22. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/1ca8c5b832302c6c94692d0875a59605 +0 -0
  23. data/spec/dummy/tmp/cache/assets/test/sprockets/2b22662f42e9f485aafa6a333faaa256 +0 -0
  24. data/spec/dummy/tmp/cache/assets/test/sprockets/2ec1baba6d6dc634d091b3acf8127cf7 +0 -0
  25. data/spec/dummy/tmp/cache/assets/test/sprockets/311f68c1b9e342ebab4c92c8cb2b5e54 +0 -0
  26. data/spec/dummy/tmp/cache/assets/test/sprockets/33ea745e7aa9669831758b7d36db1cb4 +0 -0
  27. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  28. data/spec/dummy/tmp/cache/assets/test/sprockets/3e9a6ed890157d94f18b480f0079d8e1 +0 -0
  29. data/spec/dummy/tmp/cache/assets/test/sprockets/3ef50ccfe459d5c89ecc79a448586b49 +0 -0
  30. data/spec/dummy/tmp/cache/assets/test/sprockets/46c298dc2ff12ec748c70c017684fc28 +0 -0
  31. data/spec/dummy/tmp/cache/assets/test/sprockets/476318dd8109fbf173335456cabb4128 +0 -0
  32. data/spec/dummy/tmp/cache/assets/test/sprockets/5602ee157ea76a2f44a43739a83b1a6c +0 -0
  33. data/spec/dummy/tmp/cache/assets/test/sprockets/5b5a66f4eefc591d284af6535ae474ea +0 -0
  34. data/spec/dummy/tmp/cache/assets/test/sprockets/643d60abdbcc813c95214920f12f09c3 +0 -0
  35. data/spec/dummy/tmp/cache/assets/test/sprockets/6c75b81de9afea82a6cbb56749157e3f +0 -0
  36. data/spec/dummy/tmp/cache/assets/test/sprockets/6fd5544e52538b06ac40e5b387b020a5 +0 -0
  37. data/spec/dummy/tmp/cache/assets/test/sprockets/6fed8361766f5ae3cbf781986d6945b2 +0 -0
  38. data/spec/dummy/tmp/cache/assets/test/sprockets/70ffa648dbbe0f2431e7f9307b569354 +0 -0
  39. data/spec/dummy/tmp/cache/assets/test/sprockets/76cd4393e7976d030f4623b8b6b372a0 +0 -0
  40. data/spec/dummy/tmp/cache/assets/test/sprockets/7a400f93bfb71a1a11c59b9804adda6d +0 -0
  41. data/spec/dummy/tmp/cache/assets/test/sprockets/814ca144649e7dec9e9158b3ec3460f1 +0 -0
  42. data/spec/dummy/tmp/cache/assets/test/sprockets/83de5b2d2c5d49f7737ae1f0316435ec +0 -0
  43. data/spec/dummy/tmp/cache/assets/test/sprockets/873c5252aa4eab7409b712c5e276bad2 +0 -0
  44. data/spec/dummy/tmp/cache/assets/test/sprockets/87a6ddc523ccbf2673750499bede3fc9 +0 -0
  45. data/spec/dummy/tmp/cache/assets/test/sprockets/98610661915880264fdb51c8f1a14141 +0 -0
  46. data/spec/dummy/tmp/cache/assets/test/sprockets/9a00753cdfb01f357dc39eeada77d0bc +0 -0
  47. data/spec/dummy/tmp/cache/assets/test/sprockets/9ad3db355e00d28ed3faed6dea5b1bff +0 -0
  48. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/9cbb3109d489692fd270c77ffa9d9559 +0 -0
  49. data/spec/dummy/tmp/cache/assets/test/sprockets/a22afac508f5adc12bf48d2f8333b8f7 +0 -0
  50. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/abf215c8dc45135a91f4f993514c653f +0 -0
  51. data/spec/dummy/tmp/cache/assets/test/sprockets/ac1b8c30ad00cc489b7ec78bd6e2fc6c +0 -0
  52. data/spec/dummy/tmp/cache/assets/test/sprockets/b1950420978c68074fc6fd81d4320bc0 +0 -0
  53. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/b59a10f85562b39fc7dd651965df9cab +0 -0
  54. data/spec/dummy/tmp/cache/assets/test/sprockets/b8d24bca037cf4b0a9e2979c11c8aea8 +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/bc2f15f88df08b4265c83133d6107680 +0 -0
  56. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/c0515d57887926d6e28a0f87da31ee8e +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/cce1f28f0d1f5c2817e6eaf392bac615 +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/d37cae0bfdf135e6e71bcd0572bef329 +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  60. data/spec/dummy/tmp/cache/assets/test/sprockets/dc54acb6b8cd4b84b13f440d57db37b1 +0 -0
  61. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/dec2df59b57b3639f89847e50416c924 +0 -0
  62. data/spec/dummy/tmp/cache/assets/test/sprockets/df13b2e8a88a9dcdc4a830fdd8f8d7b8 +0 -0
  63. data/spec/dummy/tmp/cache/assets/test/sprockets/e43bfee690613c316a59f122315314e5 +0 -0
  64. data/spec/dummy/tmp/cache/assets/test/sprockets/ed1d892145be7053348b0ba28c27b427 +0 -0
  65. data/spec/dummy/tmp/cache/assets/test/sprockets/efec5fde178e0875317a0d380222545d +0 -0
  66. data/spec/dummy/tmp/cache/assets/test/sprockets/f01906d52258e56e92a230dc3e55805d +0 -0
  67. data/spec/dummy/tmp/cache/assets/test/sprockets/f37842723e3572ba18f02519dab4ee77 +0 -0
  68. data/spec/dummy/tmp/cache/assets/test/sprockets/f72501aca20f34d765720253853e6105 +0 -0
  69. data/spec/dummy/tmp/cache/assets/{development → test}/sprockets/f74306735334107c5d17684f524b65cf +0 -0
  70. data/spec/dummy/tmp/cache/assets/test/sprockets/ff445b9646db9910af486791b285b112 +0 -0
  71. data/spec/dummy/tmp/cache/assets/test/sprockets/ffa1eaa25729d9d4cd7e2fd666868936 +0 -0
  72. metadata +40 -311
  73. data/app/assets/javascripts/slender_data/loading_indicator.coffee +0 -28
  74. data/lib/tasks/slender_data_tasks.rake +0 -4
  75. data/spec/dummy/log/development.log +0 -349013
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/02dabf70b4ae4a034f349ce89b4831d8 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/031a6c2e3a4e952151301446bd3fc16d +0 -0
  78. data/spec/dummy/tmp/cache/assets/development/sprockets/0373c4e5507b3195c4ad15224d991609 +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sprockets/05175bd457a57c3ad73ab9a2c8696c9b +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/086e89c7529d5063e771b41793bfe311 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/08b36042c3a4a79ebd9cee8ee1b88e6a +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/10513fd445754b59bd6001ea6ee727d9 +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sprockets/124f6816f926ae28ad20cc56425f3c91 +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/14eca89f8dccac139fd132de35d22628 +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/16c8b12ef6dcb486a7b771e43bbcc117 +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sprockets/19cdfaa89f900500a03507b86afe1231 +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sprockets/1b3a4d533a743ca2ccfbca0986613995 +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sprockets/2e2576241d2a4969c9277fe85851c92b +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sprockets/2ec1baba6d6dc634d091b3acf8127cf7 +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/2ff315acad8ceec317fd566d792df64f +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/311f68c1b9e342ebab4c92c8cb2b5e54 +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/324a5040c964d5e8d293564383c49b91 +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/3310b5a70d0b220782ab3e87642834e9 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/33ea745e7aa9669831758b7d36db1cb4 +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/3999afdceee7ca8dcf53757221c62d71 +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/3ba03b9f1aab60e78424f36e0e6cce6c +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/3e9a6ed890157d94f18b480f0079d8e1 +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/3ef50ccfe459d5c89ecc79a448586b49 +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/46c298dc2ff12ec748c70c017684fc28 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/476318dd8109fbf173335456cabb4128 +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/5602ee157ea76a2f44a43739a83b1a6c +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/5b390f4782d6b77f5aec7ec56f3ad934 +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/5b5a66f4eefc591d284af6535ae474ea +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/5c41eeb2e98dc0833647e8547880435e +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/5cd2936d626662390288ab4c07ff3957 +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/5fd362891a204d492d9fa57ffee6e114 +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/643d60abdbcc813c95214920f12f09c3 +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/6591bc7545da5a2f5f7dee20b1f110a5 +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/6597f36181468ff92ba4284afe001181 +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/69b7946c418b75e7ba78f9fc73d3e9b9 +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/6c75b81de9afea82a6cbb56749157e3f +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/6e4bc63f9308eb5929a77f7607101af1 +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/6ee2243cf1cf415b6267b84dd7b8ba77 +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/6f8457b4ba418f572891745381a1e0f5 +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/6fd5544e52538b06ac40e5b387b020a5 +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/6fed8361766f5ae3cbf781986d6945b2 +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/70ffa648dbbe0f2431e7f9307b569354 +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/731f0bc492f775825f046d500938fc5a +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/76153dd2cc3d0c6e584080efb16e872a +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/76cd4393e7976d030f4623b8b6b372a0 +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/78d5dac5e2f907dd68813ed23a0fd4ac +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/7a400f93bfb71a1a11c59b9804adda6d +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/7abf5e8d9666225cb1d7881798dbd87a +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/7d6f1f3e48f6cc97a9bb4606f8c5a020 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/814ca144649e7dec9e9158b3ec3460f1 +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/83de5b2d2c5d49f7737ae1f0316435ec +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/84c67faa73fdd082d4bd7f7712cb0499 +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/87a6ddc523ccbf2673750499bede3fc9 +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/8a90082fa76a7f37dd92a9b9a9b9f593 +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/8c5b622a33c6c034ecb4e78f131c5f73 +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/8c9851849e82bb9670e56f046df437f9 +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/8fc1455d3af69de5da04bf2a2a3f0b74 +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/96af98519e5badf206b77c3ecaf86d20 +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/98610661915880264fdb51c8f1a14141 +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/9a00753cdfb01f357dc39eeada77d0bc +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/9ad3db355e00d28ed3faed6dea5b1bff +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/a22afac508f5adc12bf48d2f8333b8f7 +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/a49d020ee42c78bf7d22a21e8ee3b80f +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/a4f4f6c56c368263c0fbcf3f1542aa73 +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/a56b8266298c4171918ee403aa1c9e0f +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sprockets/a73a44bfca198fdf779532b644ec8af5 +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sprockets/aa4a22da44bd1b7dbdbb18f983d6c09b +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sprockets/ab0236bf3eac5cd30348c18efce8246b +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sprockets/ac1b8c30ad00cc489b7ec78bd6e2fc6c +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sprockets/ae8bd07980ad64ef8e9ac3fe38413c6d +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/b1950420978c68074fc6fd81d4320bc0 +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/b2d6aa1cb303474ebf3bfc571904ad23 +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/b8d24bca037cf4b0a9e2979c11c8aea8 +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/bc2f15f88df08b4265c83133d6107680 +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/bd7ddfa86995ff5d259ea37e4a90c51c +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/c4820232e07d4e298e834c1011a72faa +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/c6babc078901541de3f4cb5cc2703bea +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/c9635dd5cbd79bdd9c58a89f6ea01595 +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/c9962abce37f5a56d5f05afe1edfe1b8 +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sprockets/cce1f28f0d1f5c2817e6eaf392bac615 +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sprockets/d37cae0bfdf135e6e71bcd0572bef329 +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sprockets/d4956056f6f35287a04295df6e52575d +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sprockets/dc54acb6b8cd4b84b13f440d57db37b1 +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sprockets/dd51c50b2d8231175e8da83e8b057120 +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sprockets/df45b0abc2c323093874639ceb72c012 +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sprockets/e0393ec0ca968f0d4182c82802da79d5 +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sprockets/e43bfee690613c316a59f122315314e5 +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sprockets/ed1d892145be7053348b0ba28c27b427 +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sprockets/ef2b922f05692ba49eb1f68801786b8e +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sprockets/efec5fde178e0875317a0d380222545d +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sprockets/f01906d52258e56e92a230dc3e55805d +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sprockets/f1b4ffa23205a95782c5c5050359429f +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sprockets/f2080a87aa027245a444b1486dce7792 +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sprockets/f37842723e3572ba18f02519dab4ee77 +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sprockets/f72501aca20f34d765720253853e6105 +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sprockets/f89dc49f90e98b448540556861f0173e +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sprockets/feadb1611975b23f2647e1ac656ad90b +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sprockets/ff445b9646db9910af486791b285b112 +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sprockets/ffa1eaa25729d9d4cd7e2fd666868936 +0 -0
  178. data/spec/dummy/tmp/cache/assets/test/sprockets/02dabf70b4ae4a034f349ce89b4831d8 +0 -0
  179. data/spec/dummy/tmp/cache/assets/test/sprockets/031a6c2e3a4e952151301446bd3fc16d +0 -0
  180. data/spec/dummy/tmp/cache/assets/test/sprockets/0373c4e5507b3195c4ad15224d991609 +0 -0
  181. data/spec/dummy/tmp/cache/assets/test/sprockets/05175bd457a57c3ad73ab9a2c8696c9b +0 -0
  182. data/spec/dummy/tmp/cache/assets/test/sprockets/086e89c7529d5063e771b41793bfe311 +0 -0
  183. data/spec/dummy/tmp/cache/assets/test/sprockets/08b36042c3a4a79ebd9cee8ee1b88e6a +0 -0
  184. data/spec/dummy/tmp/cache/assets/test/sprockets/10513fd445754b59bd6001ea6ee727d9 +0 -0
  185. data/spec/dummy/tmp/cache/assets/test/sprockets/14eca89f8dccac139fd132de35d22628 +0 -0
  186. data/spec/dummy/tmp/cache/assets/test/sprockets/16c8b12ef6dcb486a7b771e43bbcc117 +0 -0
  187. data/spec/dummy/tmp/cache/assets/test/sprockets/2e2576241d2a4969c9277fe85851c92b +0 -0
  188. data/spec/dummy/tmp/cache/assets/test/sprockets/2ff315acad8ceec317fd566d792df64f +0 -0
  189. data/spec/dummy/tmp/cache/assets/test/sprockets/324a5040c964d5e8d293564383c49b91 +0 -0
  190. data/spec/dummy/tmp/cache/assets/test/sprockets/3310b5a70d0b220782ab3e87642834e9 +0 -0
  191. data/spec/dummy/tmp/cache/assets/test/sprockets/3999afdceee7ca8dcf53757221c62d71 +0 -0
  192. data/spec/dummy/tmp/cache/assets/test/sprockets/5b390f4782d6b77f5aec7ec56f3ad934 +0 -0
  193. data/spec/dummy/tmp/cache/assets/test/sprockets/5cd2936d626662390288ab4c07ff3957 +0 -0
  194. data/spec/dummy/tmp/cache/assets/test/sprockets/6597f36181468ff92ba4284afe001181 +0 -0
  195. data/spec/dummy/tmp/cache/assets/test/sprockets/6e4bc63f9308eb5929a77f7607101af1 +0 -0
  196. data/spec/dummy/tmp/cache/assets/test/sprockets/6ee2243cf1cf415b6267b84dd7b8ba77 +0 -0
  197. data/spec/dummy/tmp/cache/assets/test/sprockets/6f8457b4ba418f572891745381a1e0f5 +0 -0
  198. data/spec/dummy/tmp/cache/assets/test/sprockets/7abf5e8d9666225cb1d7881798dbd87a +0 -0
  199. data/spec/dummy/tmp/cache/assets/test/sprockets/7d6f1f3e48f6cc97a9bb4606f8c5a020 +0 -0
  200. data/spec/dummy/tmp/cache/assets/test/sprockets/8a90082fa76a7f37dd92a9b9a9b9f593 +0 -0
  201. data/spec/dummy/tmp/cache/assets/test/sprockets/8c5b622a33c6c034ecb4e78f131c5f73 +0 -0
  202. data/spec/dummy/tmp/cache/assets/test/sprockets/8c9851849e82bb9670e56f046df437f9 +0 -0
  203. data/spec/dummy/tmp/cache/assets/test/sprockets/8fc1455d3af69de5da04bf2a2a3f0b74 +0 -0
  204. data/spec/dummy/tmp/cache/assets/test/sprockets/a4f4f6c56c368263c0fbcf3f1542aa73 +0 -0
  205. data/spec/dummy/tmp/cache/assets/test/sprockets/a56b8266298c4171918ee403aa1c9e0f +0 -0
  206. data/spec/dummy/tmp/cache/assets/test/sprockets/a73a44bfca198fdf779532b644ec8af5 +0 -0
  207. data/spec/dummy/tmp/cache/assets/test/sprockets/aa4a22da44bd1b7dbdbb18f983d6c09b +0 -0
  208. data/spec/dummy/tmp/cache/assets/test/sprockets/ab0236bf3eac5cd30348c18efce8246b +0 -0
  209. data/spec/dummy/tmp/cache/assets/test/sprockets/ae8bd07980ad64ef8e9ac3fe38413c6d +0 -0
  210. data/spec/dummy/tmp/cache/assets/test/sprockets/b2d6aa1cb303474ebf3bfc571904ad23 +0 -0
  211. data/spec/dummy/tmp/cache/assets/test/sprockets/c9962abce37f5a56d5f05afe1edfe1b8 +0 -0
  212. data/spec/dummy/tmp/cache/assets/test/sprockets/d4956056f6f35287a04295df6e52575d +0 -0
  213. data/spec/dummy/tmp/cache/assets/test/sprockets/dd51c50b2d8231175e8da83e8b057120 +0 -0
  214. data/spec/dummy/tmp/cache/assets/test/sprockets/df45b0abc2c323093874639ceb72c012 +0 -0
  215. data/spec/dummy/tmp/cache/assets/test/sprockets/e0393ec0ca968f0d4182c82802da79d5 +0 -0
  216. data/spec/dummy/tmp/cache/assets/test/sprockets/ef2b922f05692ba49eb1f68801786b8e +0 -0
  217. data/spec/dummy/tmp/cache/assets/test/sprockets/f1b4ffa23205a95782c5c5050359429f +0 -0
  218. data/spec/dummy/tmp/cache/assets/test/sprockets/f2080a87aa027245a444b1486dce7792 +0 -0
  219. data/spec/dummy/tmp/cache/assets/test/sprockets/feadb1611975b23f2647e1ac656ad90b +0 -0
@@ -26,8 +26,7 @@ describe 'BrestLoader', ->
26
26
  data: { user: { email: 'one@example.com' }}
27
27
 
28
28
  it 'returns the entry from the server as a query', ->
29
- expect(@callback).to.have.been.calledOnce
30
- expect(@callback).to.have.been.calledWith user: @user_1
29
+ expect(@callback).to.have.been.calledOnceWith user: @user_1
31
30
 
32
31
 
33
32
 
@@ -52,8 +51,7 @@ describe 'BrestLoader', ->
52
51
  { email: 'two@example.com' } ] }
53
52
 
54
53
  it 'returns the entry from the server as a multi_query', ->
55
- expect(@callback).to.have.been.calledOnce
56
- expect(@callback).to.have.been.calledWith users: [@user_1, @user_2]
54
+ expect(@callback).to.have.been.calledOnceWith users: [@user_1, @user_2]
57
55
 
58
56
 
59
57
 
@@ -177,11 +175,8 @@ describe 'BrestLoader', ->
177
175
  expect(@server_merge_api).to.have.been.calledWithMatch
178
176
  data: old_snippet_ids: [1, 2], merged_snippet_data: @merged_user
179
177
 
180
- it 'calls the given callback', ->
181
- expect(@callback).to.have.been.calledOnce
182
-
183
- it 'provides the server response to the callback', ->
184
- expect(@callback).to.have.been.calledWith user: @merged_user
178
+ it 'calls the given callback with the server response', ->
179
+ expect(@callback).to.have.been.calledOnceWith user: @merged_user
185
180
 
186
181
 
187
182
   describe 'read', ->
@@ -199,12 +194,10 @@ describe 'BrestLoader', ->
199
194
  @brest_loader.read user: {username: 'one'}, @callback
200
195
 
201
196
  it 'makes an ajax request to the REST read endpoint', ->
202
- expect(jQuery.get).to.have.been.calledOnce
203
- expect(jQuery.get).to.have.been.calledWith '/users/one.json'
197
+ expect(jQuery.get).to.have.been.calledOnceWith '/users/one.json'
204
198
 
205
199
  it 'returns the entry from the server as a query', ->
206
- expect(@callback).to.have.been.calledOnce
207
- expect(@callback).to.have.been.calledWith user: @user_1
200
+ expect(@callback).to.have.been.calledOnceWith user: @user_1
208
201
 
209
202
 
210
203
  context 'id query given', ->
@@ -213,12 +206,10 @@ describe 'BrestLoader', ->
213
206
  @brest_loader.read username: 'one', @callback
214
207
 
215
208
  it 'makes an ajax request to the REST read endpoint', ->
216
- expect(jQuery.get).to.have.been.calledOnce
217
- expect(jQuery.get).to.have.been.calledWith '/users/one.json'
209
+ expect(jQuery.get).to.have.been.calledOnceWith '/users/one.json'
218
210
 
219
211
  it 'returns the entry from the server as a query', ->
220
- expect(@callback).to.have.been.calledOnce
221
- expect(@callback).to.have.been.calledWith user: @user_1
212
+ expect(@callback).to.have.been.calledOnceWith user: @user_1
222
213
 
223
214
 
224
215
  describe 'read_many', ->
@@ -243,8 +234,7 @@ describe 'BrestLoader', ->
243
234
  expect(jQuery.ajax).to.have.been.calledWithMatch data: {usernames: 'one two'}
244
235
 
245
236
  it 'returns the entry from the server as a multi_query', ->
246
- expect(@callback).to.have.been.calledOnce
247
- expect(@callback).to.have.been.calledWith users: [@user_1, @user_2]
237
+ expect(@callback).to.have.been.calledOnceWith users: [@user_1, @user_2]
248
238
 
249
239
 
250
240
  context 'ids multi-query given', ->
@@ -258,8 +248,7 @@ describe 'BrestLoader', ->
258
248
  expect(jQuery.ajax).to.have.been.calledWithMatch data: {usernames: 'one two three'}
259
249
 
260
250
  it 'returns the entry from the server as a multi_query', ->
261
- expect(@callback).to.have.been.calledOnce
262
- expect(@callback).to.have.been.calledWith users: [@user_1, @user_2]
251
+ expect(@callback).to.have.been.calledOnceWith users: [@user_1, @user_2]
263
252
 
264
253
 
265
254
 
@@ -283,8 +272,7 @@ describe 'BrestLoader', ->
283
272
  expect(jQuery.ajax).to.have.been.calledWithMatch data: { user: { email: 'new@example.com' }}
284
273
 
285
274
  it 'returns the entry from the server as a query', ->
286
- expect(@callback).to.have.been.calledOnce
287
- expect(@callback).to.have.been.calledWith user: @user_1
275
+ expect(@callback).to.have.been.calledOnceWith user: @user_1
288
276
 
289
277
 
290
278
 
@@ -309,6 +297,5 @@ describe 'BrestLoader', ->
309
297
  { username: 'two', email: 'two@example.com' } ] }
310
298
 
311
299
  it 'returns the entry from the server as a multi_query', ->
312
- expect(@callback).to.have.been.calledOnce
313
- expect(@callback).to.have.been.calledWith users: [@user_1, @user_2]
300
+ expect(@callback).to.have.been.calledOnceWith users: [@user_1, @user_2]
314
301
 
@@ -27,40 +27,69 @@ describe 'EntryStore', ->
27
27
  result = @entry_store.add server_entry
28
28
  expect(@entry_store.get username: 'one').to.eql server_entry
29
29
 
30
- describe 'partial entries management', ->
30
+ it 'returns nothing', ->
31
+ expect(@result).to.be.undefined
31
32
 
32
- beforeEach ->
33
- @test_params.partial_entries = yes
34
- @entry_store = new slender_data.EntryStore @test_params
35
33
 
36
- context 'partial entry cached', ->
34
+ describe 'partial entries management', ->
37
35
 
38
36
  beforeEach ->
39
- @entry_store.add @partial_user_1
37
+ @test_params.partial_entries = yes
38
+ @entry_store = new slender_data.EntryStore @test_params
40
39
 
41
- it 'replaces the cached entry with the given full entry', ->
42
- @entry_store.add @full_user_1
43
- expect(@entry_store.get username: 'one').to.eql @full_user_1
40
+ context 'partial entry cached', ->
44
41
 
45
- context 'full entry cached', ->
42
+ beforeEach ->
43
+ @entry_store.add @partial_user_1
46
44
 
47
- beforeEach ->
48
- @entry_store.add @full_user_1
45
+ it 'replaces the cached entry with the given full entry', ->
46
+ @entry_store.add @full_user_1
47
+ expect(@entry_store.get username: 'one').to.eql @full_user_1
48
+
49
+ context 'full entry cached', ->
49
50
 
50
- it 'does not replace the cached value with the given partial entry', ->
51
- @entry_store.add @partial_user_1
52
- expect(@entry_store.get username: 'one').to.eql @full_user_1
51
+ beforeEach ->
52
+ @entry_store.add @full_user_1
53
+
54
+ it 'does not replace the cached value with the given partial entry', ->
55
+ @entry_store.add @partial_user_1
56
+ expect(@entry_store.get username: 'one').to.eql @full_user_1
57
+
58
+ describe 'return-editables option', ->
59
+
60
+ it 'returns editable versions of the option is set', ->
61
+ result = @entry_store.add @user_1, yes
62
+ expect(result).to.be.an.editable_version_of @user_1
63
+
64
+ it 'returns nothing if the option is not set', ->
65
+ result = @entry_store.add @user_1, no
66
+ expect(result).to.be.undefined
53
67
 
54
68
 
55
69
  describe 'add_many', ->
56
70
 
57
- beforeEach ->
58
- @result = @entry_store.add_many [@user_1, @user_2]
71
+ describe 'default behavior', ->
59
72
 
60
- it 'adds the given entries the cache', ->
61
- expect(@entry_store.get user: @user_1).to.eql @user_1
62
- expect(@entry_store.get user: @user_2).to.eql @user_2
73
+ beforeEach ->
74
+ @result = @entry_store.add_many [@user_1, @user_2]
63
75
 
76
+ it 'adds the given entries to the cache', ->
77
+ expect(@entry_store.get user: @user_1).to.eql @user_1
78
+ expect(@entry_store.get user: @user_2).to.eql @user_2
79
+
80
+ it 'returns nothing', ->
81
+ expect(@result).to.be.undefined
82
+
83
+
84
+ describe 'return_editable_version option', ->
85
+
86
+ it 'returns editable versions of the given data if set', ->
87
+ result = @entry_store.add_many [@user_1, @user_2], yes
88
+ expect(result[0]).to.be.an.editable_version_of @user_1
89
+ expect(result[1]).to.be.an.editable_version_of @user_2
90
+
91
+ it 'returns nothing if not set', ->
92
+ expect(@entry_store.add_many [@user_1, @user_2], no).to.be.undefined
64
93
 
65
94
 
66
95
  describe 'delete', ->
@@ -193,8 +222,7 @@ describe 'EntryStore', ->
193
222
  @entry_store.add @user_1
194
223
 
195
224
  it 'returns a modifiable version of existing unmodified entries', ->
196
- expect(@entry_store.get user: @user_1).to.eql @user_1
197
- expect(@entry_store.get user: @user_1).to.not.equal @user_1
225
+ expect(@entry_store.get user: @user_1).to.be.an.editable_version_of @user_1
198
226
 
199
227
  it 'returns modified entries in the modified version', ->
200
228
  user = @entry_store.get user: @user_1
@@ -248,8 +276,7 @@ describe 'EntryStore', ->
248
276
  expect(@result.found).to.eql [@user_1, @user_2]
249
277
 
250
278
  it 'returns editable versions of the cached entries', ->
251
- expect(@result.found[0]).to.eql @user_1
252
- expect(@result.found[0]).to.not.equal @user_1
279
+ expect(@result.found[0]).to.be.an.editable_version_of @user_1
253
280
 
254
281
  it 'returns the missing entries as a MultiQuery', ->
255
282
  expect(@result.missing).to.be.an.instanceof slender_data.MultiQuery
@@ -311,5 +338,5 @@ describe 'EntryStore', ->
311
338
  expect(@result.found).to.eql [@user_2]
312
339
 
313
340
  it 'reports outdated entries as missing', ->
314
- expect(@result.missing.to_hash()).to.eql users: [@user_1]
341
+ expect(@result.missing).to.eql_query users: [@user_1]
315
342
 
@@ -1,95 +1,126 @@
1
1
  #= require spec_helper
2
+ #= require slender_data/loading_tracker
2
3
 
3
4
 
4
- # Domain-specifc matcher for checking if the given snippet is currently loading.
5
- chai.Assertion.addMethod 'have_loading_id', (snippet_id) ->
6
- @assert @_obj.is_loading(id: snippet_id),
7
- """expected snippet '#{snippet_id}' to be loading,
5
+ # Domain-specifc matcher for checking if the given entry is currently loading.
6
+ chai.Assertion.addMethod 'loading', (query) ->
7
+ @assert @_obj.is_loading(query),
8
+ """expected entry '#{query.username}' to be loading,
8
9
  but it was not""",
9
- """expected snippet '#{snippet_id}' to not be loading,
10
+ """expected entry '#{query.username}' to not be loading,
10
11
  but it is"""
11
12
 
12
- #
13
- # describe 'slender_data.LoadingTracker', ->
14
- #
15
- # beforeEach ->
16
- # @loading_tracker = new slender_data.LoadingTracker()
17
- #
18
- #
19
- # describe 'is_loading', ->
20
- #
21
- # describe 'snippet is not loading', ->
22
- #
23
- # it 'returns false', ->
24
- # expect(@loading_tracker.is_loading id: 3).to.be.false
25
- #
26
- # describe 'snippet is currently loading', ->
27
- #
28
- # it 'returns true', ->
29
- # @loading_tracker.start_loading id: 3
30
- # expect(@loading_tracker.is_loading id: 3).to.be.true
31
- #
32
- #
33
- # describe 'matching_loading_ids', ->
34
- #
35
- # it 'returns the ids that are currently loading', ->
36
- # @loading_tracker.start_loadings ids: [1, 2, 3]
37
- # expect(@loading_tracker.matching_loading_ids [1, 3, 4]).to.eql [1, 3]
38
- #
39
- #
40
- # describe 'snippet_arrived', ->
41
- #
42
- # beforeEach ->
43
- # @loading_tracker.start_loadings ids: [1, 3]
44
- #
45
- # it 'calls the queued callback', (done) ->
46
- # @loading_tracker.wait_for_loading_finished id: 3, done
47
- # @loading_tracker.snippet_arrived id: 3
48
- #
49
- # it 'unregisters the arrived snippets from the loading list', ->
50
- # @loading_tracker.snippet_arrived id: 1
51
- # expect(@loading_tracker).to.not.have_loading_id 1
52
- #
53
- # it 'does not unregister other loading snippets', ->
54
- # @loading_tracker.snippet_arrived 1
55
- # expect(@loading_tracker).to.have_loading_id 3
56
- #
57
- #
58
- # describe 'start_loading', ->
59
- #
60
- # it 'stores the id of the loading query', ->
61
- # @loading_tracker.start_loading key: '3_2'
62
- # expect(@loading_tracker).to.have_loading_id 3
63
- #
64
- #
65
- # describe 'start_loadings', ->
66
- #
67
- # it 'stores the ids of the loading snippets', ->
68
- # @loading_tracker.start_loadings ids: [1, 3]
69
- # expect(@loading_tracker).to.have_loading_id 1
70
- # expect(@loading_tracker).to.not.have_loading_id 2
71
- # expect(@loading_tracker).to.have_loading_id 3
72
- #
73
- #
74
- # describe 'wait_for_loading_finished', ->
75
- #
76
- # describe 'without a request running', ->
77
- #
78
- # it 'calls the given callback immediately', (done) ->
79
- # @loading_tracker.wait_for_loading_finished id: 3, done
80
- #
81
- # describe 'while a request is running', ->
82
- #
83
- # beforeEach ->
84
- # @loading_tracker.start_loading id: 3
85
- #
86
- # it 'does not call the given callback', ->
87
- # callback = sinon.spy()
88
- # @loading_tracker.wait_for_loading_finished id: 3, callback
89
- # expect(callback.called).to.be.false
90
- #
91
- # it 'queues the given callback', ->
92
- # @loading_tracker.wait_for_loading_finished id: 3, 'callback method'
93
- # expect(@loading_tracker.loading_snippets[3]).to.eql ['callback method']
94
- #
95
- #
13
+
14
+ describe 'slender_data.LoadingTracker', ->
15
+
16
+ beforeEach ->
17
+ define_test_data this
18
+ @loading_tracker = new slender_data.LoadingTracker @test_params
19
+
20
+
21
+ describe 'entry_arrived', ->
22
+
23
+ beforeEach ->
24
+ @loading_tracker.start_loadings users: [@user_1, @user_2]
25
+
26
+ it 'calls the queued callback with the loaded entry', (done) ->
27
+ @loading_tracker.wait_for_entry_loaded user: @user_1, (entry) =>
28
+ expect(entry).to.equal @user_1
29
+ done()
30
+ @loading_tracker.entry_arrived @user_1
31
+
32
+ it 'unregisters the arrived entrys from the loading list', ->
33
+ @loading_tracker.entry_arrived @user_1
34
+ expect(@loading_tracker).to.not.have.loading user: @user_1
35
+
36
+ it 'does not unregister other loading entries', ->
37
+ @loading_tracker.entry_arrived @user_1
38
+ expect(@loading_tracker).to.have.loading user: @user_2
39
+
40
+
41
+ describe 'is_loading', ->
42
+
43
+ it 'returns false if the entry is not loading', ->
44
+ expect(@loading_tracker.is_loading id: 3).to.be.false
45
+
46
+ it 'returns true if the entry is currently loading', ->
47
+ @loading_tracker.start_loading id: 3
48
+ expect(@loading_tracker.is_loading id: 3).to.be.true
49
+
50
+
51
+ describe 'start_loading', ->
52
+
53
+ it 'stores the id of the loading query', ->
54
+ @loading_tracker.start_loading @user_1
55
+ expect(@loading_tracker).to.have.loading user: @user_1
56
+
57
+
58
+ describe 'start_loadings', ->
59
+
60
+ it 'stores the ids of the loading entries', ->
61
+ @loading_tracker.start_loadings users: [@user_1, @user_3]
62
+ expect(@loading_tracker).to.have.loading user: @user_1
63
+ expect(@loading_tracker).to.not.have.loading user: @user_2
64
+ expect(@loading_tracker).to.have.loading user: @user_3
65
+
66
+
67
+ describe 'wait_for_entry_loaded', ->
68
+
69
+ describe 'without a request running', ->
70
+
71
+ beforeEach ->
72
+ @callback = sinon.stub()
73
+ @result = @loading_tracker.wait_for_entry_loaded user: @user_1,
74
+ @callback
75
+
76
+ it 'returns the given query as the function result', ->
77
+ expect(@result).to.eql_query user: @user_1
78
+
79
+ it 'does not call the given callback', ->
80
+ expect(@callback).to.not.have.been.called
81
+
82
+ it 'does not call the given callback when the entry gets loaded later', ->
83
+ @loading_tracker.entry_arrived @user_1
84
+ expect(@callback).to.not.have.been.called
85
+
86
+
87
+ describe 'while a request is running', ->
88
+
89
+ beforeEach ->
90
+ @loading_tracker.start_loading user: @user_1
91
+ @callback = sinon.stub()
92
+ @result = @loading_tracker.wait_for_entry_loaded user: @user_1,
93
+ @callback
94
+
95
+ it 'returns nothing', ->
96
+ expect(@result).to.be.undefined
97
+
98
+ it 'does not call the given callback', ->
99
+ expect(@callback).to.not.have.been.called
100
+
101
+ it 'calls the given callback when the entry is loaded later', ->
102
+ @loading_tracker.entry_arrived @user_1
103
+ expect(@callback).to.have.been.calledOnce
104
+
105
+
106
+ describe 'wait_for_entries_loaded', ->
107
+
108
+ beforeEach ->
109
+ @loading_tracker.start_loadings users: [@user_1, @user_2]
110
+ @callback = sinon.stub()
111
+ @result = @loading_tracker.wait_for_entries_loaded users: [@user_1, @user_2, @user_3],
112
+ @callback
113
+
114
+ it 'returns a multiquery describing the entries that are not currently loading', ->
115
+ expect(@result).to.eql_query users: [@user_3]
116
+
117
+ it 'does not call the callback if not all entries have been loaded yet', ->
118
+ expect(@callback).to.not.have.been.called
119
+ @loading_tracker.entry_arrived @user_1
120
+ expect(@callback).to.not.have.been.called
121
+
122
+ it 'calls the given callback with the loaded entries when they all have loaded', ->
123
+ @loading_tracker.entry_arrived @user_1
124
+ @loading_tracker.entry_arrived @user_2
125
+ expect(@callback).to.have.been.calledOnceWith [@user_1, @user_2]
126
+
@@ -84,7 +84,7 @@ describe 'Parameterizable', ->
84
84
 
85
85
  it 'returns a query instance for the given hash', ->
86
86
  expect(@result).to.be.an.instanceof slender_data.SingleQuery
87
- expect(@result.to_hash()).to.eql @query_hash
87
+ expect(@result).to.eql_query @query_hash
88
88
 
89
89
  it 'configures the created query with the default configuration values of the current query', ->
90
90
  expect(@result.versioning).to.be.true
@@ -118,7 +118,7 @@ describe 'Parameterizable', ->
118
118
 
119
119
  it 'returns a query instance for the given hash', ->
120
120
  expect(@result).to.be.an.instanceof slender_data.MultiQuery
121
- expect(@result.to_hash()).to.eql @query_hash
121
+ expect(@result).to.eql_query @query_hash
122
122
 
123
123
  it 'configures the created query with the default configuration values of the current query', ->
124
124
  expect(@result.versioning).to.be.true
@@ -1,6 +1,31 @@
1
1
  #= require spec_helper
2
2
 
3
3
 
4
+ # Domain-specifc matcher for checking if the PersistenceManager
5
+ # has the given user in the cache (or not).
6
+ chai.Assertion.addMethod 'cached_user', (user) ->
7
+ cached_user = @_obj.get user: user
8
+ if @__flags.negate
9
+ # No cached user expected.
10
+ new chai.Assertion(cached_user,
11
+ 'Should not have cached user').to.be.undefined
12
+ else
13
+ # The given cached user expected.
14
+ new chai.Assertion(cached_user,
15
+ 'Should have cached user').to.be.eql user
16
+ new chai.Assertion(cached_user,
17
+ 'Should have cached user').to.not.be.equal user
18
+
19
+
20
+ # Domain-specifc matcher for checking if the tested object is an array
21
+ # of elements with at least the given properties.
22
+ chai.Assertion.addMethod 'entries_with_matching_properties', (attr_name, expected_values) ->
23
+ expect(@_obj).to.have.length expected_values.length
24
+ obj_values = (obj[attr_name] for obj in @_obj)
25
+ for expected_value in expected_values
26
+ expect(obj_values).to.include expected_value
27
+
28
+
4
29
  describe 'PersistenceManager', ->
5
30
 
6
31
  beforeEach ->
@@ -10,28 +35,53 @@ describe 'PersistenceManager', ->
10
35
 
11
36
  describe 'add_to_cache', ->
12
37
 
13
- beforeEach ->
14
- @result = @persistence_manager.add_to_cache @user_1
38
+ describe 'normal behavior', ->
15
39
 
16
- it 'adds the described entry to the serverside cache', ->
17
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
40
+ beforeEach ->
41
+ @result = @persistence_manager.add_to_cache @user_1
18
42
 
19
- it 'returns nothing', ->
20
- expect(@result).to.be.undefined
43
+ it 'adds the described entry to the serverside cache', ->
44
+ expect(@persistence_manager).to.have.cached_user @user_1
21
45
 
46
+ it 'returns nothing', ->
47
+ expect(@result).to.be.undefined
48
+
49
+ describe 'return_editable_version option', ->
50
+
51
+ it 'returns an editable version of the given entry when set', ->
52
+ result = @persistence_manager.add_to_cache @user_1, yes
53
+ expect(result).to.be.an.editable_version_of @user_1
54
+
55
+ it 'returns nothing if not set', ->
56
+ result = @persistence_manager.add_to_cache @user_1, no
57
+ expect(result).to.be.undefined
22
58
 
23
59
 
24
60
  describe 'add_many_to_cache', ->
25
61
 
26
- beforeEach ->
27
- @result = @persistence_manager.add_many_to_cache [ @user_1, @user_2 ]
62
+ describe 'normal behavior', ->
28
63
 
29
- it 'adds all described entries to the chache', ->
30
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
31
- expect(@persistence_manager.get user: @user_2).to.eql @user_2
64
+ beforeEach ->
65
+ @result = @persistence_manager.add_many_to_cache [@user_1, @user_2]
32
66
 
33
- it 'returns nothing', ->
34
- expect(@result).to.be.undefined
67
+ it 'adds all described entries to the chache', ->
68
+ expect(@persistence_manager).to.have.cached_user @user_1
69
+ expect(@persistence_manager).to.have.cached_user @user_2
70
+
71
+ it 'returns nothing', ->
72
+ expect(@result).to.be.undefined
73
+
74
+
75
+ describe 'return_editable_version option', ->
76
+
77
+ it 'returns editable versions of the given entries when set', ->
78
+ result = @persistence_manager.add_many_to_cache [@user_1, @user_2], yes
79
+ expect(result[0]).to.be.an.editable_version_of @user_1
80
+ expect(result[1]).to.be.an.editable_version_of @user_2
81
+
82
+ it 'returns nothing if not set', ->
83
+ result = @persistence_manager.add_many_to_cache [@user_1, @user_2], no
84
+ expect(result).to.be.undefined
35
85
 
36
86
 
37
87
 
@@ -43,19 +93,17 @@ describe 'PersistenceManager', ->
43
93
  @result = @persistence_manager.create @user_1
44
94
 
45
95
  it 'creates the entry on the server', ->
46
- expect(@server_create_api).to.have.been.calledOnce
47
- expect(@server_create_api).to.have.been.calledWith @user_1
96
+ expect(@server_create_api).to.have.been.calledOnceWith @user_1
48
97
 
49
98
  it 'adds the server response to the cache', ->
50
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
99
+ expect(@persistence_manager).to.have.cached_user @user_1
51
100
 
52
101
  it 'returns nothing', ->
53
102
  expect(@result).to.be.undefined
54
103
 
55
104
  it 'calls the given callback with an editable version of the created entry when done', (done) ->
56
105
  @persistence_manager.create @user_1, (result) =>
57
- expect(result).to.eql @user_1
58
- expect(result).to.not.equal @user_1
106
+ expect(result).to.be.an.editable_version_of @user_1
59
107
  done()
60
108
 
61
109
 
@@ -67,12 +115,11 @@ describe 'PersistenceManager', ->
67
115
  @result = @persistence_manager.create_many [@user_1, @user_2]
68
116
 
69
117
  it 'creates the entries on the server', ->
70
- expect(@server_create_many_api).to.have.been.calledOnce
71
- expect(@server_create_many_api).to.have.been.calledWith [@user_1, @user_2]
118
+ expect(@server_create_many_api).to.have.been.calledOnceWith [@user_1, @user_2]
72
119
 
73
120
  it 'adds the server response to the cache', ->
74
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
75
- expect(@persistence_manager.get user: @user_2).to.eql @user_2
121
+ expect(@persistence_manager).to.have.cached_user @user_1
122
+ expect(@persistence_manager).to.have.cached_user @user_2
76
123
 
77
124
  it 'returns nothing', ->
78
125
  expect(@result).to.be.undefined
@@ -92,11 +139,10 @@ describe 'PersistenceManager', ->
92
139
  done()
93
140
 
94
141
  it 'removes the given entry from the cache', ->
95
- expect(@persistence_manager.get user: @user_1).to.be.undefined
142
+ expect(@persistence_manager).to.not.have.cached_user @user_1
96
143
 
97
144
  it 'removes the given entry from the server', ->
98
- expect(@server_delete_api).to.have.been.calledOnce
99
- expect(@server_delete_api).to.have.been.calledWith @user_1
145
+ expect(@server_delete_api).to.have.been.calledOnceWith @user_1
100
146
 
101
147
  it 'calls the given callback with a description of the deleted entry', ->
102
148
  expect(@result).to.eql username: 'one'
@@ -111,12 +157,11 @@ describe 'PersistenceManager', ->
111
157
  @persistence_manager.delete_many [@user_1, @user_2], (@result) => done()
112
158
 
113
159
  it 'removes the given entries from the cache', ->
114
- expect(@persistence_manager.get user: @user_1).to.be.undefined
115
- expect(@persistence_manager.get user: @user_2).to.be.undefined
160
+ expect(@persistence_manager).to.not.have.cached_user @user_1
161
+ expect(@persistence_manager).to.not.have.cached_user @user_2
116
162
 
117
163
  it 'removes the given entry from the server', ->
118
- expect(@server_delete_many_api).to.have.been.calledOnce
119
- expect(@server_delete_many_api).to.have.been.calledWith [@user_1, @user_2]
164
+ expect(@server_delete_many_api).to.have.been.calledOnceWith [@user_1, @user_2]
120
165
 
121
166
  it 'calls the given callback with a description of the deleted entries', ->
122
167
  expect(@result).to.eql usernames: ['one', 'two']
@@ -131,7 +176,7 @@ describe 'PersistenceManager', ->
131
176
  @persistence_manager.add_to_cache @user_1
132
177
 
133
178
  it 'returns the described entry from the cache if it exists there', ->
134
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
179
+ expect(@persistence_manager).to.have.cached_user @user_1
135
180
 
136
181
  it 'returns undefined if the described entry is not cached', ->
137
182
  expect(@persistence_manager.get user: @user_2).to.be.undefined
@@ -213,7 +258,7 @@ describe 'PersistenceManager', ->
213
258
  expect(@result.found).to.eql [@partial_user_1, @full_user_2]
214
259
 
215
260
  it 'returns the ids of missing entries as missing', ->
216
- expect(@result.missing.to_hash()).to.eql usernames: ['three'], full: no
261
+ expect(@result.missing).to.eql_query usernames: ['three'], full: no
217
262
 
218
263
  context 'full entries requested', ->
219
264
 
@@ -225,7 +270,7 @@ describe 'PersistenceManager', ->
225
270
  expect(@result.found).to.eql [@full_user_2]
226
271
 
227
272
  it 'returns partial and missing entries as missing', ->
228
- expect(@result.missing.to_hash()).to.eql usernames: ['one', 'three'], full: yes
273
+ expect(@result.missing).to.eql_query usernames: ['one', 'three'], full: yes
229
274
 
230
275
 
231
276
  describe 'versioning', ->
@@ -238,7 +283,7 @@ describe 'PersistenceManager', ->
238
283
 
239
284
  it 'returns only results of the right version', ->
240
285
  expect(@result.found).to.eql [@user_2]
241
- expect(@result.missing.to_hash()).to.eql users: [@user_1]
286
+ expect(@result.missing).to.eql_query users: [@user_1]
242
287
 
243
288
 
244
289
  describe 'load', ->
@@ -262,6 +307,26 @@ describe 'PersistenceManager', ->
262
307
  it 'does not query the server', ->
263
308
  expect(@persistence_manager.server_api.read).to.not.have.been.called
264
309
 
310
+ context 'described entry is currently loading', ->
311
+
312
+ beforeEach ->
313
+ @persistence_manager.loading_tracker.start_loading @user_1
314
+ @callback = sinon.stub()
315
+ @persistence_manager.load user: @user_1, @callback
316
+
317
+ it 'does not make another load operation to the server', ->
318
+ expect(@server_read_api).to.not.have.been.called
319
+
320
+ it 'calls the callback with the entry when the entry returns from the server', ->
321
+ expect(@callback).to.not.have.been.called
322
+ @persistence_manager.loading_tracker.entry_arrived @user_1
323
+ expect(@callback).to.have.been.calledOnceWith @user_1
324
+
325
+ it 'adds the loaded entry to the clientside cache', ->
326
+ @persistence_manager.loading_tracker.entry_arrived @user_1
327
+ expect(@persistence_manager).to.have.cached_user @user_1
328
+
329
+
265
330
  context 'described entry is not in the cache', ->
266
331
 
267
332
  beforeEach (done) ->
@@ -271,15 +336,13 @@ describe 'PersistenceManager', ->
271
336
 
272
337
  it 'loads the entry from the server', ->
273
338
  server_read_api = @persistence_manager.server_api.read
274
- expect(server_read_api).to.have.been.calledOnce
275
- expect(server_read_api.args[0][0].to_hash()).to.eql user: @user_1
339
+ expect(server_read_api).to.have.been.calledOnceWithQuery user: @user_1
276
340
 
277
341
  it 'adds the loaded entry to the cache', ->
278
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
342
+ expect(@persistence_manager).to.have.cached_user @user_1
279
343
 
280
344
  it 'returns an editable copy of the entry loaded from the server', ->
281
- expect(@result).to.eql @user_1
282
- expect(@result).to.not.equal @user_1
345
+ expect(@result).to.be.an.editable_version_of @user_1
283
346
 
284
347
 
285
348
  describe 'partial entry functionality', ->
@@ -387,16 +450,17 @@ describe 'PersistenceManager', ->
387
450
  expect(@result).to.eql @user_1
388
451
 
389
452
  it 'updates the cache with the newly loaded entry version', ->
390
- expect(@persistence_manager.get user: @user_1).to.eql @user_1
453
+ expect(@persistence_manager).to.have.cached_user @user_1
391
454
 
392
455
 
393
456
 
394
457
  describe 'load_many', ->
395
458
 
396
- describe 'normal functionality', ->
459
+ beforeEach ->
460
+ @server_read_many_api = sinon.stub @persistence_manager.server_api, 'read_many'
397
461
 
398
- beforeEach ->
399
- @server_read_many_api = sinon.stub(@persistence_manager.server_api, 'read_many')
462
+
463
+ describe 'normal functionality', ->
400
464
 
401
465
  context 'all snippets are in the cache', ->
402
466
 
@@ -422,18 +486,18 @@ describe 'PersistenceManager', ->
422
486
  @server_read_many_api.yields users: [@user_2_from_server]
423
487
 
424
488
  it 'returns all requested snippets', (done) ->
425
- @persistence_manager.load_many users: [@user_1, @user_2, @user_3], (users) =>
426
- expect(users).to.have.length 3
427
- user_ids = (user.username for user in users)
428
- expect(user_ids).to.include 'one'
429
- expect(user_ids).to.include 'two'
430
- expect(user_ids).to.include 'three'
431
- done()
489
+ @persistence_manager.load_many users: [@user_1,
490
+ @user_2,
491
+ @user_3], (users) =>
492
+ expect(users).to.have.entries_with_matching_properties 'username',
493
+ [ 'one',
494
+ 'two',
495
+ 'three' ]
496
+ done()
432
497
 
433
498
  it 'loads the missing snippets from the server', (done) ->
434
499
  @persistence_manager.load_many users: [@user_1, @user_2, @user_3], (users) =>
435
- server_args = @server_read_many_api.args[0][0].to_hash()
436
- expect(server_args).to.eql users: [@user_2]
500
+ expect(@server_read_many_api).to.have.been.calledOnceWithQuery users: [@user_2]
437
501
  done()
438
502
 
439
503
  it 'adds the loaded entries to the cache', ->
@@ -442,7 +506,6 @@ describe 'PersistenceManager', ->
442
506
  expect(users[0]).to.not.equal @user_2_from_server
443
507
 
444
508
 
445
-
446
509
  describe 'partial entry functionality', ->
447
510
 
448
511
  beforeEach ->
@@ -468,12 +531,10 @@ describe 'PersistenceManager', ->
468
531
  expect(@persistence_manager.get username: 'two').to.eql @full_user_2
469
532
 
470
533
  it 'returns the full entries', ->
471
- expect(@result).to.have.length 3
472
- emails = (entry.email for entry in @result)
473
- expect(emails).to.include 'one@example.com'
474
- expect(emails).to.include 'two@example.com'
475
- expect(emails).to.include 'three@example.com'
476
-
534
+ expect(@result).to.have.entries_with_matching_properties 'email',
535
+ [ 'one@example.com',
536
+ 'two@example.com',
537
+ 'three@example.com' ]
477
538
 
478
539
  context 'partial entries requested', ->
479
540
 
@@ -504,13 +565,59 @@ describe 'PersistenceManager', ->
504
565
  expect(@result).to.eql [@user_2, @user_1]
505
566
 
506
567
  it 'loads only outdated entries from the server', ->
507
- expect(@server_read_many_api).to.have.been.calledOnce
508
- expect(@server_read_many_api.args[0][0].to_hash()).to.eql users: [@user_1]
568
+ expect(@server_read_many_api).to.have.been.calledOnceWithQuery users: [@user_1]
509
569
 
510
570
  it 'adds the loaded entries to the cache', ->
511
571
  expect(@persistence_manager.get username: 'one').to.eql @user_1
512
572
 
513
573
 
574
+ describe 'loading tracking', ->
575
+
576
+ context 'some entries are currently loading', ->
577
+
578
+ beforeEach ->
579
+ @persistence_manager.loading_tracker.start_loadings users: [@user_1, @user_2]
580
+ @callback = sinon.stub()
581
+ @persistence_manager.load_many users: [@user_1, @user_2], @callback
582
+
583
+ it 'does not make another load operation to the server', ->
584
+ expect(@server_read_many_api).to.not.have.been.called
585
+
586
+ it 'calls the callback with the entries when they arrive', ->
587
+ expect(@callback).to.not.have.been.called
588
+ @persistence_manager.loading_tracker.entries_arrived [@user_1, @user_2]
589
+ expect(@callback).to.have.been.calledOnceWith [@user_1, @user_2]
590
+
591
+ it 'adds the loaded result to the cache', ->
592
+ @persistence_manager.loading_tracker.entries_arrived [@user_1, @user_2]
593
+ expect(@persistence_manager).to.have.cached_user @user_1
594
+ expect(@persistence_manager).to.have.cached_user @user_2
595
+
596
+
597
+ describe 'all options working together', ->
598
+
599
+ beforeEach ->
600
+ @persistence_manager.add_to_cache @user_1
601
+ @persistence_manager.loading_tracker.start_loadings users: [@user_2]
602
+ @callback = sinon.stub()
603
+ @server_read_many_api.yields users: [@user_3]
604
+ @persistence_manager.load_many users: [@user_1, @user_2, @user_3],
605
+ @callback
606
+ @persistence_manager.loading_tracker.entries_arrived [@user_2]
607
+
608
+ it 'returns all requested entries', ->
609
+ expect(@callback).to.have.been.calledOnce
610
+ callback_args = @callback.args[0][0]
611
+ expect(callback_args).to.be.entries_with_matching_properties 'username',
612
+ [ 'one',
613
+ 'two',
614
+ 'three' ]
615
+
616
+ it 'loads only the not currently loading entries from the server', ->
617
+ expect(@server_read_many_api).to.have.been.calledOnceWithQuery users: [@user_3]
618
+
619
+
620
+
514
621
  describe 'merge', ->
515
622
 
516
623
  beforeEach ->
@@ -528,9 +635,9 @@ describe 'PersistenceManager', ->
528
635
  expect(@server_merge_api).to.have.been.calledOnce
529
636
 
530
637
  it 'removes the old users from the client cache', ->
531
- expect(@persistence_manager.get user: @user_1).to.be.undefined
532
- expect(@persistence_manager.get user: @user_2).to.be.undefined
533
- expect(@persistence_manager.get user: @user_3).to.eql @user_3
638
+ expect(@persistence_manager).to.not.have.cached_user @user_1
639
+ expect(@persistence_manager).to.not.have.cached_user @user_2
640
+ expect(@persistence_manager).to.have.cached_user @user_3
534
641
 
535
642
  it 'adds the user provided by the server to the client cache', ->
536
643
  cached_user = @persistence_manager.get user: @merged_user_server_response
@@ -541,8 +648,7 @@ describe 'PersistenceManager', ->
541
648
 
542
649
  it 'returns the editable user in the callback', ->
543
650
  callback_args = @callback.args[0][0]
544
- expect(callback_args).to.eql @merged_user_server_response
545
- expect(callback_args).to.not.equal @merged_user_server_response
651
+ expect(callback_args).to.be.an.editable_version_of @merged_user_server_response
546
652
 
547
653
 
548
654
 
@@ -577,12 +683,11 @@ describe 'PersistenceManager', ->
577
683
  @persistence_manager.update @user, (@result) => done()
578
684
 
579
685
  it 'calls the server with only the changed attributes as payload', ->
580
- expect(@server_update_api).to.have.been.calledOnce
581
- expect(@server_update_api).to.have.been.calledWith
686
+ expect(@server_update_api).to.have.been.calledOnceWith
582
687
  username: 'one', email: 'new_one@example.com'
583
688
 
584
- it 'calls the callback with the server response when done', ->
585
- expect(@result).to.eql user: @user
689
+ it 'calls the callback with the editable version of the updated entry', ->
690
+ expect(@result).to.be.an.editable_version_of @user
586
691
 
587
692
  it 'stores the now persisted changes on the client', (done) ->
588
693
  @persistence_manager.update @user, =>