prosperity 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +31 -0
  4. data/app/assets/javascripts/prosperity/application.js.coffee +42 -0
  5. data/app/assets/stylesheets/prosperity/application.css.scss +19 -0
  6. data/app/controllers/prosperity/application_controller.rb +4 -0
  7. data/app/controllers/prosperity/metrics_controller.rb +9 -0
  8. data/app/helpers/prosperity/application_helper.rb +7 -0
  9. data/app/helpers/prosperity/metrics_helper.rb +11 -0
  10. data/app/views/layouts/prosperity/application.html.haml +37 -0
  11. data/app/views/prosperity/metrics/index.html.haml +7 -0
  12. data/config/routes.rb +5 -0
  13. data/db/migrate/20131026214127_test.rb +4 -0
  14. data/lib/prosperity/engine.rb +9 -0
  15. data/lib/prosperity/exception.rb +11 -0
  16. data/lib/prosperity/extractors/base.rb +11 -0
  17. data/lib/prosperity/extractors/count.rb +18 -0
  18. data/lib/prosperity/extractors/group.rb +23 -0
  19. data/lib/prosperity/metric.rb +48 -0
  20. data/lib/prosperity/metric_finder.rb +14 -0
  21. data/lib/prosperity/metrics/option.rb +9 -0
  22. data/lib/prosperity/metrics.rb +5 -0
  23. data/lib/prosperity/period.rb +11 -0
  24. data/lib/prosperity/periods.rb +6 -0
  25. data/lib/prosperity/version.rb +3 -0
  26. data/lib/prosperity.rb +4 -0
  27. data/lib/tasks/prosperity_tasks.rake +4 -0
  28. data/spec/controllers/prosperity/metrics_controller_spec.rb +14 -0
  29. data/spec/dummy/README.rdoc +28 -0
  30. data/spec/dummy/Rakefile +8 -0
  31. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  32. data/spec/dummy/app/assets/javascripts/users.js +2 -0
  33. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  34. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  35. data/spec/dummy/app/assets/stylesheets/users.css +4 -0
  36. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  37. data/spec/dummy/app/controllers/users_controller.rb +58 -0
  38. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/app/helpers/users_helper.rb +2 -0
  40. data/spec/dummy/app/models/user.rb +2 -0
  41. data/spec/dummy/app/prosperity/users_metric.rb +3 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/spec/dummy/app/views/users/_form.html.erb +25 -0
  44. data/spec/dummy/app/views/users/edit.html.erb +6 -0
  45. data/spec/dummy/app/views/users/index.html.erb +29 -0
  46. data/spec/dummy/app/views/users/new.html.erb +5 -0
  47. data/spec/dummy/app/views/users/show.html.erb +14 -0
  48. data/spec/dummy/bin/bundle +3 -0
  49. data/spec/dummy/bin/rails +4 -0
  50. data/spec/dummy/bin/rake +4 -0
  51. data/spec/dummy/config/application.rb +23 -0
  52. data/spec/dummy/config/boot.rb +5 -0
  53. data/spec/dummy/config/database.yml +24 -0
  54. data/spec/dummy/config/environment.rb +5 -0
  55. data/spec/dummy/config/environments/development.rb +29 -0
  56. data/spec/dummy/config/environments/production.rb +80 -0
  57. data/spec/dummy/config/environments/test.rb +36 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  60. data/spec/dummy/config/initializers/inflections.rb +16 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  63. data/spec/dummy/config/initializers/session_store.rb +3 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/config/locales/en.yml +23 -0
  66. data/spec/dummy/config/routes.rb +6 -0
  67. data/spec/dummy/config.ru +4 -0
  68. data/spec/dummy/db/development.sqlite3 +0 -0
  69. data/spec/dummy/db/migrate/20131026214807_create_users.rb +10 -0
  70. data/spec/dummy/db/schema.rb +26 -0
  71. data/spec/dummy/db/seeds.rb +7 -0
  72. data/spec/dummy/db/test.sqlite3 +0 -0
  73. data/spec/dummy/log/development.log +18945 -0
  74. data/spec/dummy/log/test.log +1992 -0
  75. data/spec/dummy/public/404.html +58 -0
  76. data/spec/dummy/public/422.html +58 -0
  77. data/spec/dummy/public/500.html +57 -0
  78. data/spec/dummy/public/favicon.ico +0 -0
  79. data/spec/dummy/tmp/cache/assets/development/sass/34a577735054231563e7022ea73e1468db9203ba/application.css.scssc +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_alerts.scssc +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_badges.scssc +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_bootstrap.scssc +0 -0
  83. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_breadcrumbs.scssc +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_button-groups.scssc +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_buttons.scssc +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_carousel.scssc +0 -0
  87. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_close.scssc +0 -0
  88. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_code.scssc +0 -0
  89. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_component-animations.scssc +0 -0
  90. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_dropdowns.scssc +0 -0
  91. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_forms.scssc +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_glyphicons.scssc +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_grid.scssc +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_input-groups.scssc +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_jumbotron.scssc +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_labels.scssc +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_list-group.scssc +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_media.scssc +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_mixins.scssc +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_modals.scssc +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_navbar.scssc +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_navs.scssc +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_normalize.scssc +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_pager.scssc +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_pagination.scssc +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_panels.scssc +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_popovers.scssc +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_print.scssc +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_progress-bars.scssc +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_responsive-utilities.scssc +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_scaffolding.scssc +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_tables.scssc +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_thumbnails.scssc +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_tooltip.scssc +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_type.scssc +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_utilities.scssc +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_variables.scssc +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sass/994e9de37e7f58fef085c22ad997b3c9ce2a4b39/_wells.scssc +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sass/be34d2a735e9e523a3c8b9414be4508380964813/bootstrap.scssc +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/043337ddb7f545a88004b2eb2a069b4d +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/05ee6e5d8777628542d4ed27eab34c5a +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/07080bfb6d1d7b60d61990c547c0f47a +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/073948f1a0c619142ecfcb14a5806302 +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/07e8fb2db7d85e29590a6b05160ca825 +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/0800f54ee19cf3cee10b956fa9786799 +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/12eb9637e2c654371ecf7033d5a5cb36 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/1502b34f91cda1f4222490f78c0fea39 +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/1533bcf4a8f5a745dfda80cebd88d217 +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/177ca1f3e92db4f8a8f6e7ad9786ebfc +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/18d7d771937643bc7e9210b1a80e5763 +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/197492ed379339e17a0f5d01d3b01b8c +0 -0
  133. data/spec/dummy/tmp/cache/assets/development/sprockets/1c55cf24465f311353197ce336df0178 +0 -0
  134. data/spec/dummy/tmp/cache/assets/development/sprockets/1cb94582c835e73b3fd3c276f9a7de56 +0 -0
  135. data/spec/dummy/tmp/cache/assets/development/sprockets/203047a4141cf08162077e7290421bbb +0 -0
  136. data/spec/dummy/tmp/cache/assets/development/sprockets/210050da208fb75a75b701bfa4e8470f +0 -0
  137. data/spec/dummy/tmp/cache/assets/development/sprockets/29a6c93aeb91d07a5533b3adba7697d0 +0 -0
  138. data/spec/dummy/tmp/cache/assets/development/sprockets/29ac2be474969468157245a7f8737fa4 +0 -0
  139. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  140. data/spec/dummy/tmp/cache/assets/development/sprockets/314e44d29ecc7449c9ca3b754329c245 +0 -0
  141. data/spec/dummy/tmp/cache/assets/development/sprockets/3162d1398d6940ee5e933b7ab4d2273d +0 -0
  142. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  143. data/spec/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
  144. data/spec/dummy/tmp/cache/assets/development/sprockets/3d80e2a5faaf2bd987d804c17aead745 +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sprockets/4050a4e5062ab95c9f32e9b6940821ea +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sprockets/4155a156cc6ffb880b56dbc34346fbc0 +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sprockets/4166fe47cddf4ba18c53b843d69b4c5f +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/4432a4b71ce9551df8d4b3860f4b9be3 +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/5479c7b4fba9179d4d1dc59ae64964c1 +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/5a3ab9afd151c265cf11c621c0ddbe00 +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/647038c58f26163a9217646e1e5f09ae +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/64e0150fafbd9aaa3822efa1abb0211d +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/6536a3eb4b5d05368d260a46f2485ead +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/65c2d908dbca1bc833ae0b552f6c27fa +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sprockets/6882b260ae69f1594eff540d803e5ac3 +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sprockets/726d3f6850549a59954f0bf5584cfd9f +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sprockets/75f2f1e32219e0b89c069e43b49e0e49 +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sprockets/7ab9ac7cc2529219a4c68fd7854d5c0f +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sprockets/7abbc975e6786a54d660e0cf19aab1f0 +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sprockets/7bac3aca131c870ad5b07d8ccdc86e06 +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sprockets/7ffb7c821c008cd2a390dc7aba74361f +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sprockets/80392355fc6e00cf69b2cd46978ebcbe +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sprockets/8084620ce7f95d2b2aeb65c977c62af1 +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sprockets/874b42463fefbb0bce47775722ebb4ae +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sprockets/87b209c0c9da28094a8d5581a21262c6 +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sprockets/87ef8ddd2847d19f22a16d726b88b433 +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sprockets/91ae0bd43f98b4f1f111e0bdc178302c +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sprockets/9a7970620504bfe92af14fd57ee08365 +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sprockets/9c8440c4efec99d4a380eeda42f089c7 +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sprockets/9e4cf41800946fd32bcfa3591b304eb6 +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sprockets/a2b14d5c46db32da9183354fb3fcd0bf +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sprockets/a6d6196cfd275dea0718553a95f997a5 +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sprockets/a7a8652a3fb42ef81fac3ab77949f82d +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sprockets/a9d839f632f9ce73fc221b79b39b0924 +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sprockets/bae0ea1201e2ec9420712ff54b3254aa +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sprockets/c05c4a514cf0b61ad7b223ee732cd6df +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sprockets/c29c465933e7e86d6f6224f5e78c5baf +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sprockets/c975834a35907ecd2d314bbd6844ee88 +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sprockets/cebc6db0bbb8120f430da3970b173d2f +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sprockets/cf4affc50c6303e717d6514380d1f417 +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sprockets/d0194b0fba4290072cfff0be06b348fd +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  187. data/spec/dummy/tmp/cache/assets/development/sprockets/d8487b3a1dc72a1361b96fbbc93255c6 +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sprockets/d8b357d5741711da2dd710af0e15d268 +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sprockets/e02b5049cf477b43a72b4a00e2fceb46 +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sprockets/e0be9bf6ab486a790bda60b51224b404 +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sprockets/e22a1b318499e7f06ea9274e18ab004f +0 -0
  192. data/spec/dummy/tmp/cache/assets/development/sprockets/e298cc3a8203ab1fb6978a90254f8926 +0 -0
  193. data/spec/dummy/tmp/cache/assets/development/sprockets/e2a9bdd87a2d19256837fce6544a122c +0 -0
  194. data/spec/dummy/tmp/cache/assets/development/sprockets/e868f358fe87542c483951a2d9f532b6 +0 -0
  195. data/spec/dummy/tmp/cache/assets/development/sprockets/e8a6adf580ebd1942f4aabe6738678c2 +0 -0
  196. data/spec/dummy/tmp/cache/assets/development/sprockets/ea081ed20ad78a3e8f41a529b6baa2e1 +0 -0
  197. data/spec/dummy/tmp/cache/assets/development/sprockets/ec956e1f28c818063bb61958fe5ae855 +0 -0
  198. data/spec/dummy/tmp/cache/assets/development/sprockets/ed71f99e0a9653296abd5d6f501dd898 +0 -0
  199. data/spec/dummy/tmp/cache/assets/development/sprockets/eee3cb53f216eaa12dd927f144640d0d +0 -0
  200. data/spec/dummy/tmp/cache/assets/development/sprockets/efe6f2d16d3a1819817efb8734daf8af +0 -0
  201. data/spec/dummy/tmp/cache/assets/development/sprockets/f03e99bdb4159ae3485ca2858716e19b +0 -0
  202. data/spec/dummy/tmp/cache/assets/development/sprockets/f29bc513eb7c7d4b79d53d51363f7f1f +0 -0
  203. data/spec/dummy/tmp/cache/assets/development/sprockets/f56253b5f374fff1a33fbbc9881c9124 +0 -0
  204. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  205. data/spec/dummy/tmp/cache/assets/development/sprockets/fc2c22310cbb7abb26ae64d4aafa37cb +0 -0
  206. data/spec/dummy/tmp/restart.txt +0 -0
  207. data/spec/helpers/prosperity/metrics_helper_spec.rb +6 -0
  208. data/spec/lib/prosperity/extractors/base_spec.rb +8 -0
  209. data/spec/lib/prosperity/extractors/count_spec.rb +35 -0
  210. data/spec/lib/prosperity/extractors/group_spec.rb +34 -0
  211. data/spec/lib/prosperity/metric_finder_spec.rb +20 -0
  212. data/spec/lib/prosperity/metric_spec.rb +49 -0
  213. data/spec/lib/prosperity/metrics/option_spec.rb +7 -0
  214. data/spec/lib/prosperity/period_spec.rb +7 -0
  215. data/spec/lib/prosperity/periods_spec.rb +7 -0
  216. data/spec/spec_helper.rb +17 -0
  217. data/spec/support/test_database.rb +18 -0
  218. data/spec/test_files/metrics/users_metric.rb +4 -0
  219. data/vendor/assets/javascripts/chart.js +1426 -0
  220. data/vendor/assets/stylesheets/bootstrap-theme.min.css +9 -0
  221. data/vendor/assets/stylesheets/bootstrap.min.css +9 -0
  222. metadata +526 -0
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ module Prosperity
4
+ describe Metric do
5
+ context "A simple scope metric" do
6
+ subject do
7
+ Class.new(Metric) do
8
+ scope { User }
9
+ end.new
10
+ end
11
+
12
+ it "groups by created_at by default" do
13
+ subject.group_by.should == :created_at
14
+ end
15
+
16
+ it "gets the scope" do
17
+ subject.scope.should == User
18
+ end
19
+ end
20
+
21
+ context "a metric missing the scope" do
22
+ subject do
23
+ Class.new(Metric) do
24
+ end
25
+ end
26
+
27
+ it "raises an exception when accessing the scope" do
28
+ expect { subject.scope }.to raise_exception(MissingScope)
29
+ end
30
+ end
31
+
32
+ context "A simple scope metric with multiple options" do
33
+ subject do
34
+ Class.new(Metric) do
35
+ scope { User }
36
+ options "active" do |scope|
37
+ scope.active
38
+ end
39
+ end.new
40
+ end
41
+
42
+ it "should have multiple options" do
43
+ subject.options.size.should == 2
44
+ subject.options['default'].should be_present
45
+ subject.options['active'].should be_present
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ module Prosperity
4
+ describe Metrics::Option do
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ module Prosperity
4
+ describe Period do
5
+
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ module Prosperity
4
+ describe Periods do
5
+
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+ require 'pry-debugger'
7
+
8
+ Dir[File.join(__dir__, "support/**/*.rb")].each {|f| require f }
9
+ TEST_FILES = File.join(__dir__, "test_files")
10
+
11
+ RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.run_all_when_everything_filtered = true
14
+ config.filter_run :focus
15
+
16
+ config.order = 'random'
17
+ end
@@ -0,0 +1,18 @@
1
+ # Create a dummy schema for testing
2
+ class User < ActiveRecord::Base
3
+ end
4
+
5
+ RSpec.configure do |config|
6
+ config.before(:suite) do
7
+ m = ActiveRecord::Migration
8
+ m.verbose = false
9
+
10
+ m.drop_table :users if ActiveRecord::Base.connection.tables.include?("users")
11
+
12
+ m.create_table :users do |t|
13
+ t.string :email
14
+ t.string :name
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,4 @@
1
+ class UsersMetric < Prosperity::Metric
2
+ scope { User }
3
+ end
4
+