magic_carpet 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +232 -0
  4. data/Rakefile +15 -0
  5. data/app/assets/javascripts/magic_carpet/application.js +13 -0
  6. data/app/assets/javascripts/magic_carpet/magic_carpet.js +80 -0
  7. data/app/assets/stylesheets/magic_carpet/application.css +13 -0
  8. data/app/controllers/magic_carpet/application_controller.rb +4 -0
  9. data/app/controllers/magic_carpet/js_fixtures_controller.rb +110 -0
  10. data/app/helpers/magic_carpet/application_helper.rb +4 -0
  11. data/app/helpers/magic_carpet/js_fixtures_helper.rb +139 -0
  12. data/config/routes.rb +3 -0
  13. data/lib/magic_carpet/engine.rb +12 -0
  14. data/lib/magic_carpet/version.rb +3 -0
  15. data/lib/magic_carpet.rb +4 -0
  16. data/lib/tasks/magic_carpet_tasks.rake +4 -0
  17. data/spec/controllers/magic_carpet/js_fixtures_controller_spec.rb +275 -0
  18. data/spec/dummy/README.rdoc +28 -0
  19. data/spec/dummy/Rakefile +6 -0
  20. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  21. data/spec/dummy/app/assets/javascripts/jquery-2.1.0.js +9111 -0
  22. data/spec/dummy/app/assets/javascripts/users.js +2 -0
  23. data/spec/dummy/app/assets/javascripts/wishes.js +2 -0
  24. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  25. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  26. data/spec/dummy/app/assets/stylesheets/users.css +4 -0
  27. data/spec/dummy/app/assets/stylesheets/wishes.css +4 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  29. data/spec/dummy/app/controllers/users_controller.rb +58 -0
  30. data/spec/dummy/app/controllers/wishes_controller.rb +70 -0
  31. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  32. data/spec/dummy/app/helpers/users_helper.rb +2 -0
  33. data/spec/dummy/app/helpers/wishes_helper.rb +2 -0
  34. data/spec/dummy/app/models/user.rb +3 -0
  35. data/spec/dummy/app/models/wish.rb +4 -0
  36. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  37. data/spec/dummy/app/views/layouts/other_layout.html.erb +15 -0
  38. data/spec/dummy/app/views/shared/_id_able.html.erb +5 -0
  39. data/spec/dummy/app/views/users/_form.html.erb +29 -0
  40. data/spec/dummy/app/views/users/edit.html.erb +6 -0
  41. data/spec/dummy/app/views/users/index.html.erb +31 -0
  42. data/spec/dummy/app/views/users/new.html.erb +5 -0
  43. data/spec/dummy/app/views/users/show.html.erb +19 -0
  44. data/spec/dummy/app/views/wishes/_form.html.erb +21 -0
  45. data/spec/dummy/app/views/wishes/_some_partial.html.erb +1 -0
  46. data/spec/dummy/app/views/wishes/_wish.html.erb +6 -0
  47. data/spec/dummy/app/views/wishes/_wish_list_item.html.erb +3 -0
  48. data/spec/dummy/app/views/wishes/edit.html.erb +6 -0
  49. data/spec/dummy/app/views/wishes/index.html.erb +22 -0
  50. data/spec/dummy/app/views/wishes/local_models.html.erb +3 -0
  51. data/spec/dummy/app/views/wishes/locals.html.erb +6 -0
  52. data/spec/dummy/app/views/wishes/new.html.erb +5 -0
  53. data/spec/dummy/app/views/wishes/numbers.html.erb +4 -0
  54. data/spec/dummy/app/views/wishes/plain.html.erb +1 -0
  55. data/spec/dummy/app/views/wishes/show.html.erb +9 -0
  56. data/spec/dummy/bin/bundle +3 -0
  57. data/spec/dummy/bin/rails +4 -0
  58. data/spec/dummy/bin/rake +4 -0
  59. data/spec/dummy/config/application.rb +28 -0
  60. data/spec/dummy/config/boot.rb +5 -0
  61. data/spec/dummy/config/database.yml +25 -0
  62. data/spec/dummy/config/environment.rb +5 -0
  63. data/spec/dummy/config/environments/development.rb +29 -0
  64. data/spec/dummy/config/environments/production.rb +80 -0
  65. data/spec/dummy/config/environments/test.rb +36 -0
  66. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  67. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  68. data/spec/dummy/config/initializers/inflections.rb +16 -0
  69. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  70. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  71. data/spec/dummy/config/initializers/session_store.rb +3 -0
  72. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  73. data/spec/dummy/config/locales/en.yml +23 -0
  74. data/spec/dummy/config/routes.rb +9 -0
  75. data/spec/dummy/config.ru +4 -0
  76. data/spec/dummy/db/development.sqlite3 +0 -0
  77. data/spec/dummy/db/migrate/20140201230228_create_wishes.rb +9 -0
  78. data/spec/dummy/db/migrate/20140201230247_create_users.rb +11 -0
  79. data/spec/dummy/db/migrate/20140208042514_associate_users_and_wishes.rb +5 -0
  80. data/spec/dummy/db/schema.rb +31 -0
  81. data/spec/dummy/db/test.sqlite3 +0 -0
  82. data/spec/dummy/log/development.log +21112 -0
  83. data/spec/dummy/log/test.log +33634 -0
  84. data/spec/dummy/public/404.html +58 -0
  85. data/spec/dummy/public/422.html +58 -0
  86. data/spec/dummy/public/500.html +57 -0
  87. data/spec/dummy/public/favicon.ico +0 -0
  88. data/spec/dummy/spec/javascripts/helpers/spec_helper.js +367 -0
  89. data/spec/dummy/spec/javascripts/magic_carpet_spec.js +314 -0
  90. data/spec/dummy/spec/javascripts/support/jasmine.yml +29 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/0743af5c3f490550c6a448f45e6889b4 +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/0800f54ee19cf3cee10b956fa9786799 +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/082245bc7cce1345893a81643f76284a +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/08b0d9573e11dc361c93563cec2a0106 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/09f277e17472af932cda6f7dd86ff943 +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/0e3142f2ae2a0b8902383f65b86a5299 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/0f87038bb320b83592e071bff83e4195 +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/10925724a66880466e7f3b4e158196cb +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/10fb651bf6e564ad505e391670c11a8d +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/12090b2e7e2e9ac2632e486d02ee346a +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/142047722c23a8e9a96c6355d224b67e +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/1b4c56479f40fe3f7fc8daf684f4f71c +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/1c3579416ea74586464f5969c6949d5d +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/1e259f0863fa6da47ded59eef77ac351 +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/21d2c592e1570709ecd1208a030cfc66 +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/220ab8240fd9e0712b64dd9ff515f5df +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/277a51802284d997817fcaca55211243 +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/28c409c3bba590030a8074120aa781db +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/35906b4cd565b14db8ba786fc66c7eb3 +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/388a1d725ffd01cc06a34d720ea97775 +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/442917e5b534e0e7ac0a3bac0c5299e7 +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/45ccf991e042a7cf7abe52d1125eeae3 +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/469198efe71fedae413489ff2fad66e4 +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/4817f65b5fc5c2042e04af7eb83a4c99 +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/497ff8927ce695e3febb3cdfd3e4a74e +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/51202fde1d49c04c5d5588ca203b7b1e +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/55ea602f40a0ad2185e22964a16b4d42 +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/596788b2d37e650dd4cf582b185f9d37 +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/5c09faba4e454de97f078861e82db15c +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/64de9e1fa2dd01768d6e85552dcdb18a +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/68c5fa1f98ca79274b1f6750d8611af5 +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/6bcea01ea8389e9a2ee296904803a01c +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/7406b6e2ecfc7b024db7822fb753c796 +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/744bda5bad4a3b9b9b244a4583fb6e29 +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/786804147f5da16b37ef8932e422797c +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/793dc2ede21315a9eabfe2b0a0ff13d4 +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/7b1c8fbfabc405ee6e5c8887095e6b43 +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/7c2edc3a2733a7bc22c572af66983a2e +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/7cd1032c2c1fa8a02016ac207cd9c76f +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/7d4bf0f7a6d67ade27f05b9bbdfaa13f +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/809136388a8f6d7a862b20361fad205c +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/80ba335c5610df2a1defeab247d03cc9 +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/817b43e6477d4059b9006261356b7147 +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/81b537f4760199f4030b928268605909 +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sprockets/83521bb0fd5da34426e16d8825eb314e +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sprockets/85b590662faa5956a7cb3a38390f16ca +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sprockets/8733ef9be8fb368ac9aa5b1ccbfce14c +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sprockets/8931ae3296ab13e8eed90f434208887f +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/8cb4c1afbd9a270155d8cdd697a8b20d +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/8d1f1fbd708160b30af96a108fef6c0d +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/91ef1ca0ef363be62f4a38fb3fbc2291 +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/9a25637a28779d7c49c40044188bd0e5 +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/a0d10779d647db6ab1328734733a0e4d +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/a0e04aab47dc3631152c26632687f898 +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/a74883b193a8e72f27cba5703a696a89 +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/a839288628913e4533ef8cba740de1eb +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/a95ead461bd72142ffb3040f8cd7cfa0 +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sprockets/ac47afc414ae67e366a330dc003edf1a +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sprockets/b1d1383958868d6f0e9e05c848682d70 +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sprockets/b4ff5ac95c02b56ca97786b337f8b845 +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sprockets/b718bc4e8c8146520d982e086897fe24 +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sprockets/b848029d2fa6db3db28ccbce818b399b +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sprockets/ba05f15307eb6d2c7e31e50768867139 +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sprockets/c1a8bdfcb2dca842a48acc85d3ff658a +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sprockets/c2eb6c5cabed0e6b333c035ac8400bbc +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sprockets/c3dbe303660d299b488648fc157fd32b +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sprockets/c45af704cb234484a8e1d0852f8fe0bc +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sprockets/c4868ba5188e0672b480e24d979224d0 +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sprockets/caa2f86bb055636b69e292f2ae993914 +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sprockets/ce4b669883cb8df0ccd1c6aca12e0434 +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sprockets/cebc6db0bbb8120f430da3970b173d2f +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sprockets/d8a7bed1e7150777f59a9e107c1acaa8 +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sprockets/db4f843f0e597f7ba079bec345a91d58 +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sprockets/dd5a838f402c1f78ff0f6e43b3ce6624 +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sprockets/dfd7187ca1d53815395570d20d933e13 +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sprockets/e4092eb95487a855cb730373c97b8756 +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sprockets/e41b3d9532b5ef87c246ef6eb88417ed +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sprockets/e8266bddb6510ce3a2bc5ae1469ab3f6 +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sprockets/e86f67e739e4d85d5b8b1830b327ee67 +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sprockets/efc1c13c84f6f8686ade375b47913c8d +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sprockets/f1e3cae1b4d4c1085b32f88d26fd1f89 +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sprockets/f21b1a83f2c41f61ba73c424b057ee19 +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sprockets/f25cc7f3223a9259336cb2dd38df220e +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  187. data/spec/dummy/tmp/cache/assets/test/sprockets/10fb651bf6e564ad505e391670c11a8d +0 -0
  188. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  189. data/spec/dummy/tmp/cache/assets/test/sprockets/142047722c23a8e9a96c6355d224b67e +0 -0
  190. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  191. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  192. data/spec/dummy/tmp/cache/assets/test/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
  193. data/spec/dummy/tmp/cache/assets/test/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
  194. data/spec/dummy/tmp/cache/assets/test/sprockets/51202fde1d49c04c5d5588ca203b7b1e +0 -0
  195. data/spec/dummy/tmp/cache/assets/test/sprockets/596788b2d37e650dd4cf582b185f9d37 +0 -0
  196. data/spec/dummy/tmp/cache/assets/test/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
  197. data/spec/dummy/tmp/cache/assets/test/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
  198. data/spec/dummy/tmp/cache/assets/test/sprockets/81b537f4760199f4030b928268605909 +0 -0
  199. data/spec/dummy/tmp/cache/assets/test/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
  200. data/spec/dummy/tmp/cache/assets/test/sprockets/8cb4c1afbd9a270155d8cdd697a8b20d +0 -0
  201. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  202. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  203. data/spec/dummy/tmp/cache/assets/test/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
  204. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  205. data/spec/dummy/tmp/jasmine/assets/application.js +9132 -0
  206. data/spec/dummy/tmp/jasmine/assets/boot.js +204 -0
  207. data/spec/dummy/tmp/jasmine/assets/helpers/spec_helper.js +462 -0
  208. data/spec/dummy/tmp/jasmine/assets/jasmine-console-reporter.js +125 -0
  209. data/spec/dummy/tmp/jasmine/assets/jasmine-console-shims.js +31 -0
  210. data/spec/dummy/tmp/jasmine/assets/jasmine-html.js +360 -0
  211. data/spec/dummy/tmp/jasmine/assets/jasmine-specs.js +0 -0
  212. data/spec/dummy/tmp/jasmine/assets/jasmine.css +55 -0
  213. data/spec/dummy/tmp/jasmine/assets/jasmine.js +2403 -0
  214. data/spec/dummy/tmp/jasmine/assets/jquery-2.1.0.js +9112 -0
  215. data/spec/dummy/tmp/jasmine/assets/json2.js +479 -0
  216. data/spec/dummy/tmp/jasmine/assets/magic_carpet/application.js +95 -0
  217. data/spec/dummy/tmp/jasmine/assets/magic_carpet/magic_carpet.js +81 -0
  218. data/spec/dummy/tmp/jasmine/assets/magic_carpet_spec.js +317 -0
  219. data/spec/dummy/tmp/jasmine/assets/users.js +3 -0
  220. data/spec/dummy/tmp/jasmine/assets/wishes.js +3 -0
  221. data/spec/dummy/tmp/jasmine/runner.html +28 -0
  222. data/spec/dummy/tmp/pids/server.pid +1 -0
  223. data/spec/helpers/magic_carpet/js_fixtures_helper_spec.rb +249 -0
  224. data/spec/spec_helper.rb +14 -0
  225. metadata +590 -0
@@ -0,0 +1,125 @@
1
+ /**
2
+ Jasmine Reporter that outputs test results to the browser console.
3
+ Useful for running in a headless environment such as PhantomJs, ZombieJs etc.
4
+
5
+ Usage:
6
+ // From your html file that loads jasmine:
7
+ jasmine.getEnv().execute();
8
+ */
9
+
10
+
11
+ (function() {
12
+ var ConsoleReporter,
13
+ root = this;
14
+
15
+ if (!jasmine) {
16
+ throw "jasmine library isn't loaded!";
17
+ }
18
+
19
+ var ANSI = {};
20
+ ANSI.color_map = {
21
+ "green" : 32,
22
+ "red" : 31
23
+ };
24
+
25
+ ANSI.colorize_text = function(text, color) {
26
+ var color_code = this.color_map[color];
27
+ return "\033[" + color_code + "m" + text + "\033[0m";
28
+ };
29
+
30
+ ConsoleReporter = function() {
31
+ if (!console || !console.log) { throw "console isn't present!"; }
32
+ this.status = this.statuses.stopped;
33
+ };
34
+
35
+ var proto = ConsoleReporter.prototype;
36
+ proto.statuses = {
37
+ stopped : "stopped",
38
+ running : "running",
39
+ fail : "fail",
40
+ success : "success"
41
+ };
42
+
43
+ proto.reportRunnerStarting = proto.jasmineStarted = function(runner) {
44
+ this.status = this.statuses.running;
45
+ this.start_time = (new Date()).getTime();
46
+ this.executed_specs = 0;
47
+ this.passed_specs = 0;
48
+ this.log("Starting...");
49
+ };
50
+
51
+ proto.reportRunnerResults = proto.jasmineDone = function(runner) {
52
+ var failed = this.executed_specs - this.passed_specs;
53
+ var spec_str = this.executed_specs + (this.executed_specs === 1 ? " spec, " : " specs, ");
54
+ var fail_str = failed + (failed === 1 ? " failure in " : " failures in ");
55
+ var color = (failed > 0)? "red" : "green";
56
+ var dur = (new Date()).getTime() - this.start_time;
57
+
58
+ this.log("");
59
+ this.log("Finished");
60
+ this.log("-----------------");
61
+ this.log(spec_str + fail_str + (dur/1000) + "s.", color);
62
+
63
+ this.status = (failed > 0)? this.statuses.fail : this.statuses.success;
64
+
65
+ /* Print something that signals that testing is over so that headless browsers
66
+ like PhantomJs know when to terminate. */
67
+ this.log("");
68
+ this.log("ConsoleReporter finished");
69
+ };
70
+
71
+ proto.reportSpecStarting = proto.specStarted = function(spec) {
72
+ this.executed_specs++;
73
+ };
74
+
75
+ proto.reportSpecResults = proto.specDone = function(spec) {
76
+ if(spec.results) { //jasmine 1.x
77
+ var specResult = spec.results()
78
+ if(specResult.skipped) {
79
+ return;
80
+ } else if(specResult.passed()) {
81
+ this.passed_specs++;
82
+ return;
83
+ }
84
+ } else { //jasmine 2.x
85
+ if(spec.status === "passed") {
86
+ this.passed_specs++;
87
+ return;
88
+ } else if(spec.status !== "failed") {
89
+ //Skipped or Pending
90
+ return;
91
+ }
92
+ }
93
+
94
+ var fullName, failedExpectations;
95
+ if(spec.suite) { //jasmine 1.x
96
+ fullName = spec.suite.description + " " + spec.description;
97
+ failedExpectations = spec.results().getItems().map(function(expectation){
98
+ console.log(JSON.stringify(expectation))
99
+ return " " + expectation.message +
100
+ (expectation.trace && expectation.trace.stack ? "\n " + expectation.trace.stack : "" );
101
+ });
102
+ } else { //jasmine 2.x
103
+ fullName = spec.fullName;
104
+ failedExpectations = spec.failedExpectations.map(function(expectation){
105
+ if(expectation.message === "undefined: undefined") {
106
+ return " An unstructured exception was thrown (use `new Error(message)` for better output).";
107
+ } else {
108
+ return " " + expectation.message + "\n" +
109
+ " " + expectation.stack;
110
+ }
111
+ });
112
+ }
113
+
114
+ this.log(fullName, "red");
115
+ this.log(failedExpectations.join("\n\n"), "red");
116
+ };
117
+
118
+ proto.log = function(str, color) {
119
+ var text = (color != undefined)? ANSI.colorize_text(str, color) : str;
120
+ console.log(text)
121
+ };
122
+
123
+ jasmine.ConsoleReporter = ConsoleReporter;
124
+ jasmine.getEnv().addReporter(new jasmine.ConsoleReporter());
125
+ })();
@@ -0,0 +1,31 @@
1
+ (function() {
2
+ /**
3
+ * Function.bind for ECMAScript 5 Support
4
+ *
5
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
6
+ */
7
+
8
+ if (!Function.prototype.bind) {
9
+ Function.prototype.bind = function (oThis) {
10
+ if (typeof this !== "function") {
11
+ // closest thing possible to the ECMAScript 5 internal IsCallable function
12
+ throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
13
+ }
14
+
15
+ var aArgs = Array.prototype.slice.call(arguments, 1),
16
+ fToBind = this,
17
+ fNOP = function () {},
18
+ fBound = function () {
19
+ return fToBind.apply(this instanceof fNOP && oThis
20
+ ? this
21
+ : oThis,
22
+ aArgs.concat(Array.prototype.slice.call(arguments)));
23
+ };
24
+
25
+ fNOP.prototype = this.prototype;
26
+ fBound.prototype = new fNOP();
27
+
28
+ return fBound;
29
+ };
30
+ }
31
+ })();
@@ -0,0 +1,360 @@
1
+ /*
2
+ Copyright (c) 2008-2013 Pivotal Labs
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ jasmineRequire.html = function(j$) {
25
+ j$.ResultsNode = jasmineRequire.ResultsNode();
26
+ j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
27
+ j$.QueryString = jasmineRequire.QueryString();
28
+ j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
29
+ };
30
+
31
+ jasmineRequire.HtmlReporter = function(j$) {
32
+
33
+ var noopTimer = {
34
+ start: function() {},
35
+ elapsed: function() { return 0; }
36
+ };
37
+
38
+ function HtmlReporter(options) {
39
+ var env = options.env || {},
40
+ getContainer = options.getContainer,
41
+ createElement = options.createElement,
42
+ createTextNode = options.createTextNode,
43
+ onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
44
+ timer = options.timer || noopTimer,
45
+ results = [],
46
+ specsExecuted = 0,
47
+ failureCount = 0,
48
+ pendingSpecCount = 0,
49
+ htmlReporterMain,
50
+ symbols;
51
+
52
+ this.initialize = function() {
53
+ htmlReporterMain = createDom("div", {className: "html-reporter"},
54
+ createDom("div", {className: "banner"},
55
+ createDom("span", {className: "title"}, "Jasmine"),
56
+ createDom("span", {className: "version"}, j$.version)
57
+ ),
58
+ createDom("ul", {className: "symbol-summary"}),
59
+ createDom("div", {className: "alert"}),
60
+ createDom("div", {className: "results"},
61
+ createDom("div", {className: "failures"})
62
+ )
63
+ );
64
+ getContainer().appendChild(htmlReporterMain);
65
+
66
+ symbols = find(".symbol-summary");
67
+ };
68
+
69
+ var totalSpecsDefined;
70
+ this.jasmineStarted = function(options) {
71
+ totalSpecsDefined = options.totalSpecsDefined || 0;
72
+ timer.start();
73
+ };
74
+
75
+ var summary = createDom("div", {className: "summary"});
76
+
77
+ var topResults = new j$.ResultsNode({}, "", null),
78
+ currentParent = topResults;
79
+
80
+ this.suiteStarted = function(result) {
81
+ currentParent.addChild(result, "suite");
82
+ currentParent = currentParent.last();
83
+ };
84
+
85
+ this.suiteDone = function(result) {
86
+ if (currentParent == topResults) {
87
+ return;
88
+ }
89
+
90
+ currentParent = currentParent.parent;
91
+ };
92
+
93
+ this.specStarted = function(result) {
94
+ currentParent.addChild(result, "spec");
95
+ };
96
+
97
+ var failures = [];
98
+ this.specDone = function(result) {
99
+ if (result.status != "disabled") {
100
+ specsExecuted++;
101
+ }
102
+
103
+ symbols.appendChild(createDom("li", {
104
+ className: result.status,
105
+ id: "spec_" + result.id,
106
+ title: result.fullName
107
+ }
108
+ ));
109
+
110
+ if (result.status == "failed") {
111
+ failureCount++;
112
+
113
+ var failure =
114
+ createDom("div", {className: "spec-detail failed"},
115
+ createDom("div", {className: "description"},
116
+ createDom("a", {title: result.fullName, href: specHref(result)}, result.fullName)
117
+ ),
118
+ createDom("div", {className: "messages"})
119
+ );
120
+ var messages = failure.childNodes[1];
121
+
122
+ for (var i = 0; i < result.failedExpectations.length; i++) {
123
+ var expectation = result.failedExpectations[i];
124
+ messages.appendChild(createDom("div", {className: "result-message"}, expectation.message));
125
+ messages.appendChild(createDom("div", {className: "stack-trace"}, expectation.stack));
126
+ }
127
+
128
+ failures.push(failure);
129
+ }
130
+
131
+ if (result.status == "pending") {
132
+ pendingSpecCount++;
133
+ }
134
+ };
135
+
136
+ this.jasmineDone = function() {
137
+ var banner = find(".banner");
138
+ banner.appendChild(createDom("span", {className: "duration"}, "finished in " + timer.elapsed() / 1000 + "s"));
139
+
140
+ var alert = find(".alert");
141
+
142
+ alert.appendChild(createDom("span", { className: "exceptions" },
143
+ createDom("label", { className: "label", 'for': "raise-exceptions" }, "raise exceptions"),
144
+ createDom("input", {
145
+ className: "raise",
146
+ id: "raise-exceptions",
147
+ type: "checkbox"
148
+ })
149
+ ));
150
+ var checkbox = find("input");
151
+
152
+ checkbox.checked = !env.catchingExceptions();
153
+ checkbox.onclick = onRaiseExceptionsClick;
154
+
155
+ if (specsExecuted < totalSpecsDefined) {
156
+ var skippedMessage = "Ran " + specsExecuted + " of " + totalSpecsDefined + " specs - run all";
157
+ alert.appendChild(
158
+ createDom("span", {className: "bar skipped"},
159
+ createDom("a", {href: "?", title: "Run all specs"}, skippedMessage)
160
+ )
161
+ );
162
+ }
163
+ var statusBarMessage = "" + pluralize("spec", specsExecuted) + ", " + pluralize("failure", failureCount);
164
+ if (pendingSpecCount) { statusBarMessage += ", " + pluralize("pending spec", pendingSpecCount); }
165
+
166
+ var statusBarClassName = "bar " + ((failureCount > 0) ? "failed" : "passed");
167
+ alert.appendChild(createDom("span", {className: statusBarClassName}, statusBarMessage));
168
+
169
+ var results = find(".results");
170
+ results.appendChild(summary);
171
+
172
+ summaryList(topResults, summary);
173
+
174
+ function summaryList(resultsTree, domParent) {
175
+ var specListNode;
176
+ for (var i = 0; i < resultsTree.children.length; i++) {
177
+ var resultNode = resultsTree.children[i];
178
+ if (resultNode.type == "suite") {
179
+ var suiteListNode = createDom("ul", {className: "suite", id: "suite-" + resultNode.result.id},
180
+ createDom("li", {className: "suite-detail"},
181
+ createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description)
182
+ )
183
+ );
184
+
185
+ summaryList(resultNode, suiteListNode);
186
+ domParent.appendChild(suiteListNode);
187
+ }
188
+ if (resultNode.type == "spec") {
189
+ if (domParent.getAttribute("class") != "specs") {
190
+ specListNode = createDom("ul", {className: "specs"});
191
+ domParent.appendChild(specListNode);
192
+ }
193
+ specListNode.appendChild(
194
+ createDom("li", {
195
+ className: resultNode.result.status,
196
+ id: "spec-" + resultNode.result.id
197
+ },
198
+ createDom("a", {href: specHref(resultNode.result)}, resultNode.result.description)
199
+ )
200
+ );
201
+ }
202
+ }
203
+ }
204
+
205
+ if (failures.length) {
206
+ alert.appendChild(
207
+ createDom('span', {className: "menu bar spec-list"},
208
+ createDom("span", {}, "Spec List | "),
209
+ createDom('a', {className: "failures-menu", href: "#"}, "Failures")));
210
+ alert.appendChild(
211
+ createDom('span', {className: "menu bar failure-list"},
212
+ createDom('a', {className: "spec-list-menu", href: "#"}, "Spec List"),
213
+ createDom("span", {}, " | Failures ")));
214
+
215
+ find(".failures-menu").onclick = function() {
216
+ setMenuModeTo('failure-list');
217
+ };
218
+ find(".spec-list-menu").onclick = function() {
219
+ setMenuModeTo('spec-list');
220
+ };
221
+
222
+ setMenuModeTo('failure-list');
223
+
224
+ var failureNode = find(".failures");
225
+ for (var i = 0; i < failures.length; i++) {
226
+ failureNode.appendChild(failures[i]);
227
+ }
228
+ }
229
+ };
230
+
231
+ return this;
232
+
233
+ function find(selector) {
234
+ return getContainer().querySelector(selector);
235
+ }
236
+
237
+ function createDom(type, attrs, childrenVarArgs) {
238
+ var el = createElement(type);
239
+
240
+ for (var i = 2; i < arguments.length; i++) {
241
+ var child = arguments[i];
242
+
243
+ if (typeof child === 'string') {
244
+ el.appendChild(createTextNode(child));
245
+ } else {
246
+ if (child) {
247
+ el.appendChild(child);
248
+ }
249
+ }
250
+ }
251
+
252
+ for (var attr in attrs) {
253
+ if (attr == "className") {
254
+ el[attr] = attrs[attr];
255
+ } else {
256
+ el.setAttribute(attr, attrs[attr]);
257
+ }
258
+ }
259
+
260
+ return el;
261
+ }
262
+
263
+ function pluralize(singular, count) {
264
+ var word = (count == 1 ? singular : singular + "s");
265
+
266
+ return "" + count + " " + word;
267
+ }
268
+
269
+ function specHref(result) {
270
+ return "?spec=" + encodeURIComponent(result.fullName);
271
+ }
272
+
273
+ function setMenuModeTo(mode) {
274
+ htmlReporterMain.setAttribute("class", "html-reporter " + mode);
275
+ }
276
+ }
277
+
278
+ return HtmlReporter;
279
+ };
280
+
281
+ jasmineRequire.HtmlSpecFilter = function() {
282
+ function HtmlSpecFilter(options) {
283
+ var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
284
+ var filterPattern = new RegExp(filterString);
285
+
286
+ this.matches = function(specName) {
287
+ return filterPattern.test(specName);
288
+ };
289
+ }
290
+
291
+ return HtmlSpecFilter;
292
+ };
293
+
294
+ jasmineRequire.ResultsNode = function() {
295
+ function ResultsNode(result, type, parent) {
296
+ this.result = result;
297
+ this.type = type;
298
+ this.parent = parent;
299
+
300
+ this.children = [];
301
+
302
+ this.addChild = function(result, type) {
303
+ this.children.push(new ResultsNode(result, type, this));
304
+ };
305
+
306
+ this.last = function() {
307
+ return this.children[this.children.length - 1];
308
+ };
309
+ }
310
+
311
+ return ResultsNode;
312
+ };
313
+
314
+ jasmineRequire.QueryString = function() {
315
+ function QueryString(options) {
316
+
317
+ this.setParam = function(key, value) {
318
+ var paramMap = queryStringToParamMap();
319
+ paramMap[key] = value;
320
+ options.getWindowLocation().search = toQueryString(paramMap);
321
+ };
322
+
323
+ this.getParam = function(key) {
324
+ return queryStringToParamMap()[key];
325
+ };
326
+
327
+ return this;
328
+
329
+ function toQueryString(paramMap) {
330
+ var qStrPairs = [];
331
+ for (var prop in paramMap) {
332
+ qStrPairs.push(encodeURIComponent(prop) + "=" + encodeURIComponent(paramMap[prop]));
333
+ }
334
+ return "?" + qStrPairs.join('&');
335
+ }
336
+
337
+ function queryStringToParamMap() {
338
+ var paramStr = options.getWindowLocation().search.substring(1),
339
+ params = [],
340
+ paramMap = {};
341
+
342
+ if (paramStr.length > 0) {
343
+ params = paramStr.split('&');
344
+ for (var i = 0; i < params.length; i++) {
345
+ var p = params[i].split('=');
346
+ var value = decodeURIComponent(p[1]);
347
+ if (value === "true" || value === "false") {
348
+ value = JSON.parse(value);
349
+ }
350
+ paramMap[decodeURIComponent(p[0])] = value;
351
+ }
352
+ }
353
+
354
+ return paramMap;
355
+ }
356
+
357
+ }
358
+
359
+ return QueryString;
360
+ };
File without changes
@@ -0,0 +1,55 @@
1
+ body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
2
+
3
+ .html-reporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
4
+ .html-reporter a { text-decoration: none; }
5
+ .html-reporter a:hover { text-decoration: underline; }
6
+ .html-reporter p, .html-reporter h1, .html-reporter h2, .html-reporter h3, .html-reporter h4, .html-reporter h5, .html-reporter h6 { margin: 0; line-height: 14px; }
7
+ .html-reporter .banner, .html-reporter .symbol-summary, .html-reporter .summary, .html-reporter .result-message, .html-reporter .spec .description, .html-reporter .spec-detail .description, .html-reporter .alert .bar, .html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; }
8
+ .html-reporter .banner .version { margin-left: 14px; }
9
+ .html-reporter #jasmine_content { position: fixed; right: 100%; }
10
+ .html-reporter .version { color: #aaaaaa; }
11
+ .html-reporter .banner { margin-top: 14px; }
12
+ .html-reporter .duration { color: #aaaaaa; float: right; }
13
+ .html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; }
14
+ .html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; }
15
+ .html-reporter .symbol-summary li.passed { font-size: 14px; }
16
+ .html-reporter .symbol-summary li.passed:before { color: #5e7d00; content: "\02022"; }
17
+ .html-reporter .symbol-summary li.failed { line-height: 9px; }
18
+ .html-reporter .symbol-summary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
19
+ .html-reporter .symbol-summary li.disabled { font-size: 14px; }
20
+ .html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; }
21
+ .html-reporter .symbol-summary li.pending { line-height: 17px; }
22
+ .html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; }
23
+ .html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
24
+ .html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
25
+ .html-reporter .bar.failed { background-color: #b03911; }
26
+ .html-reporter .bar.passed { background-color: #a6b779; }
27
+ .html-reporter .bar.skipped { background-color: #bababa; }
28
+ .html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; }
29
+ .html-reporter .bar.menu a { color: #333333; }
30
+ .html-reporter .bar a { color: white; }
31
+ .html-reporter.spec-list .bar.menu.failure-list, .html-reporter.spec-list .results .failures { display: none; }
32
+ .html-reporter.failure-list .bar.menu.spec-list, .html-reporter.failure-list .summary { display: none; }
33
+ .html-reporter .running-alert { background-color: #666666; }
34
+ .html-reporter .results { margin-top: 14px; }
35
+ .html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
36
+ .html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
37
+ .html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
38
+ .html-reporter.showDetails .summary { display: none; }
39
+ .html-reporter.showDetails #details { display: block; }
40
+ .html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
41
+ .html-reporter .summary { margin-top: 14px; }
42
+ .html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; }
43
+ .html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; }
44
+ .html-reporter .summary li.passed a { color: #5e7d00; }
45
+ .html-reporter .summary li.failed a { color: #b03911; }
46
+ .html-reporter .summary li.pending a { color: #ba9d37; }
47
+ .html-reporter .description + .suite { margin-top: 0; }
48
+ .html-reporter .suite { margin-top: 14px; }
49
+ .html-reporter .suite a { color: #333333; }
50
+ .html-reporter .failures .spec-detail { margin-bottom: 28px; }
51
+ .html-reporter .failures .spec-detail .description { background-color: #b03911; }
52
+ .html-reporter .failures .spec-detail .description a { color: white; }
53
+ .html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; }
54
+ .html-reporter .result-message span.result { display: block; }
55
+ .html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }