ui_changed 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/app/assets/javascripts/ui_changed/application.js +17 -0
  2. data/app/assets/javascripts/ui_changed/screenshots.js +280 -0
  3. data/app/assets/stylesheets/scaffold.css +56 -0
  4. data/app/assets/stylesheets/ui_changed/application.css.scss +17 -0
  5. data/app/assets/stylesheets/ui_changed/screenshot_ignore_urls.css +4 -0
  6. data/app/assets/stylesheets/ui_changed/screenshots.css +24 -0
  7. data/app/controllers/ui_changed/application_controller.rb +4 -0
  8. data/app/controllers/ui_changed/screenshot_ignore_urls_controller.rb +61 -0
  9. data/app/controllers/ui_changed/screenshots_controller.rb +266 -0
  10. data/app/controllers/ui_changed/screenshots_controller_base.rb +26 -0
  11. data/app/helpers/ui_changed/application_helper.rb +45 -0
  12. data/app/helpers/ui_changed/screenshot_ignore_urls_helper.rb +4 -0
  13. data/app/helpers/ui_changed/screenshots_helper.rb +4 -0
  14. data/app/mailers/ui_changed/notifications_mailer.rb +57 -0
  15. data/app/models/ui_changed/all_screenshot.rb +11 -0
  16. data/app/models/ui_changed/config_helper.rb +12 -0
  17. data/app/models/ui_changed/screenshot.rb +258 -0
  18. data/app/models/ui_changed/screenshot_ignore_url.rb +15 -0
  19. data/app/views/layouts/ui_changed/application.html.haml +15 -0
  20. data/app/views/ui_changed/screenshot_ignore_urls/index.haml +21 -0
  21. data/app/views/ui_changed/screenshots/_side_nav.haml +32 -0
  22. data/app/views/ui_changed/screenshots/_top_buttons.haml +36 -0
  23. data/app/views/ui_changed/screenshots/diff.haml +17 -0
  24. data/app/views/ui_changed/screenshots/diffs.haml +35 -0
  25. data/app/views/ui_changed/screenshots/index.haml +31 -0
  26. data/app/views/ui_changed/screenshots/screenshots.haml +30 -0
  27. data/app/workers/ui_changed/compare.rb +11 -0
  28. data/app/workers/ui_changed/crawl_control.rb +11 -0
  29. data/app/workers/ui_changed/crawl_test.rb +11 -0
  30. data/app/workers/ui_changed/worker_base.rb +206 -0
  31. data/config/initializers/load_config.rb +1 -0
  32. data/config/routes.rb +40 -0
  33. data/db/migrate/20130203000059_create_ui_changed_screenshots.rb +18 -0
  34. data/db/migrate/20130203001050_create_ui_changed_screenshot_ignore_urls.rb +9 -0
  35. data/lib/generators/ui_changed/resque_generator.rb +11 -0
  36. data/lib/generators/ui_changed/templates/resque.rb +7 -0
  37. data/lib/tasks/ui_changed_tasks.rake +42 -0
  38. data/lib/ui_changed/engine.rb +18 -0
  39. data/lib/ui_changed/railtie.rb +12 -0
  40. data/lib/ui_changed/version.rb +3 -0
  41. data/lib/ui_changed.rb +5 -0
  42. data/spec/dummy/README.rdoc +261 -0
  43. data/spec/dummy/Rakefile +7 -0
  44. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  45. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  46. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  47. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  49. data/spec/dummy/chromedriver.log +486 -0
  50. data/spec/dummy/config/application.rb +59 -0
  51. data/spec/dummy/config/boot.rb +10 -0
  52. data/spec/dummy/config/database.yml +20 -0
  53. data/spec/dummy/config/environment.rb +5 -0
  54. data/spec/dummy/config/environments/development.rb +37 -0
  55. data/spec/dummy/config/environments/production.rb +67 -0
  56. data/spec/dummy/config/environments/test.rb +37 -0
  57. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/dummy/config/initializers/inflections.rb +15 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  60. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  61. data/spec/dummy/config/initializers/session_store.rb +8 -0
  62. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  63. data/spec/dummy/config/locales/en.yml +5 -0
  64. data/spec/dummy/config/routes.rb +4 -0
  65. data/spec/dummy/config/ui_changed.yml +25 -0
  66. data/spec/dummy/config.ru +4 -0
  67. data/spec/dummy/db/development.sqlite3 +0 -0
  68. data/spec/dummy/db/schema.rb +37 -0
  69. data/spec/dummy/log/development.log +28757 -0
  70. data/spec/dummy/log/test.log +47119 -0
  71. data/spec/dummy/public/404.html +26 -0
  72. data/spec/dummy/public/422.html +26 -0
  73. data/spec/dummy/public/500.html +25 -0
  74. data/spec/dummy/public/favicon.ico +0 -0
  75. data/spec/dummy/script/rails +6 -0
  76. data/spec/dummy/tmp/cache/assets/C25/650/sprockets%2F2146cc379ac52d93283881b087238840 +0 -0
  77. data/spec/dummy/tmp/cache/assets/C88/A00/sprockets%2F1576563f31b9463de3b98380b65316ec +0 -0
  78. data/spec/dummy/tmp/cache/assets/C9B/6B0/sprockets%2F14ad16343013da7f4c5807074f60da43 +0 -0
  79. data/spec/dummy/tmp/cache/assets/CB1/9B0/sprockets%2F11e63881c7fd93eb64b28b031752f184 +0 -0
  80. data/spec/dummy/tmp/cache/assets/CB6/C00/sprockets%2Fb3476726ad470583738cd4b345f805fa +0 -0
  81. data/spec/dummy/tmp/cache/assets/CB7/210/sprockets%2F138a8a31cd8188425abf378b7580856b +0 -0
  82. data/spec/dummy/tmp/cache/assets/CC0/7C0/sprockets%2Fdb1c954004648bf1999b7ef93c470907 +0 -0
  83. data/spec/dummy/tmp/cache/assets/CC1/7E0/sprockets%2F552f5b296379701887bf62b61e1eef55 +0 -0
  84. data/spec/dummy/tmp/cache/assets/CC2/E90/sprockets%2F5ca8fbc29937906ce87a35703a588175 +0 -0
  85. data/spec/dummy/tmp/cache/assets/CCE/6B0/sprockets%2F3c43115c074131cc27dff45ad1436d39 +0 -0
  86. data/spec/dummy/tmp/cache/assets/CE1/C50/sprockets%2Fb8c09b0556e29fb12b443f9491758ba1 +0 -0
  87. data/spec/dummy/tmp/cache/assets/CE2/4F0/sprockets%2F6cf98982c6e31026cd1b25b10d91d955 +0 -0
  88. data/spec/dummy/tmp/cache/assets/CE2/C60/sprockets%2F05ee6fb6374ce346eb036fa585800159 +0 -0
  89. data/spec/dummy/tmp/cache/assets/CE4/590/sprockets%2F3f8762728eca1e27313d667a68da61d2 +0 -0
  90. data/spec/dummy/tmp/cache/assets/CE7/120/sprockets%2F91db081288bd6181c67f7f600d8ac179 +0 -0
  91. data/spec/dummy/tmp/cache/assets/CE9/6D0/sprockets%2F8eeb2f4e707f4444d25caf8597182412 +0 -0
  92. data/spec/dummy/tmp/cache/assets/CF1/2F0/sprockets%2F84b5d275d61e77e4c8e971305e71b4d9 +0 -0
  93. data/spec/dummy/tmp/cache/assets/CF5/010/sprockets%2Ff9d2179a39f51f93bc6f88003845d72f +0 -0
  94. data/spec/dummy/tmp/cache/assets/D05/6A0/sprockets%2F8d3a80f374b4052fa19d7903c0615dda +0 -0
  95. data/spec/dummy/tmp/cache/assets/D06/890/sprockets%2F078f78e2e12080050f3bc2eab77b24d8 +0 -0
  96. data/spec/dummy/tmp/cache/assets/D0E/710/sprockets%2F98ad5b57d4c0b614b15d44e16c20988c +0 -0
  97. data/spec/dummy/tmp/cache/assets/D18/E30/sprockets%2F373b25f3feb8e02173177a3258fa9f8f +0 -0
  98. data/spec/dummy/tmp/cache/assets/D1B/200/sprockets%2Feb488fd44186315924274c9fbddf26c1 +0 -0
  99. data/spec/dummy/tmp/cache/assets/D2B/650/sprockets%2F17e0bd2471845003ab1d326b9df4fb2d +0 -0
  100. data/spec/dummy/tmp/cache/assets/D33/A80/sprockets%2Fe0e3c435fb1e0437fd54f6118152dbd4 +0 -0
  101. data/spec/dummy/tmp/cache/assets/D51/3D0/sprockets%2F0b8889dd27a294e91ac45d88f45ab19e +0 -0
  102. data/spec/dummy/tmp/cache/assets/D52/FC0/sprockets%2Fc7ee307174bd9ce8d84a7a714989de50 +0 -0
  103. data/spec/dummy/tmp/cache/assets/D57/590/sprockets%2Fa5889cfed7da6867603309e46febf336 +0 -0
  104. data/spec/dummy/tmp/cache/assets/D62/A70/sprockets%2F9da26ba4665f1bd1946b15f4fb7c00a2 +0 -0
  105. data/spec/dummy/tmp/cache/assets/D64/280/sprockets%2F41468fda40a48db35907717ec1cae4aa +0 -0
  106. data/spec/dummy/tmp/cache/assets/D65/BE0/sprockets%2Facc8f0cfb7c0b17255efd15087505b18 +0 -0
  107. data/spec/dummy/tmp/cache/assets/D6C/9E0/sprockets%2F8168f977dd050ba2afddd02af6139c71 +0 -0
  108. data/spec/dummy/tmp/cache/assets/D70/3A0/sprockets%2Fe4a9a1e8cb76dfec37b1f404f8519240 +0 -0
  109. data/spec/dummy/tmp/cache/assets/D74/BE0/sprockets%2Fd7aee2b6e1730859c0e0467f1d7cce93 +0 -0
  110. data/spec/dummy/tmp/cache/assets/D78/BC0/sprockets%2F207af09f77a5d6abe8dc1e03949835fc +0 -0
  111. data/spec/dummy/tmp/cache/assets/D84/D90/sprockets%2Fb8af3475f4baf9fd7b6a7c46c7451868 +0 -0
  112. data/spec/dummy/tmp/cache/assets/D8B/A20/sprockets%2F3ed551887fcdca6e97a755b75f945c6d +0 -0
  113. data/spec/dummy/tmp/cache/assets/D8E/0D0/sprockets%2F8742e2ef2bd56a3d1d0bb872b3cc217a +0 -0
  114. data/spec/dummy/tmp/cache/assets/D9F/BC0/sprockets%2F2f95d2d7024aadccb97622d868ec4db2 +0 -0
  115. data/spec/dummy/tmp/cache/assets/D9F/DC0/sprockets%2F37e94b5bc0f9440b90d05da4e4feee63 +0 -0
  116. data/spec/dummy/tmp/cache/assets/DB5/B70/sprockets%2F9b6928fa917be6edb53695facf9037db +0 -0
  117. data/spec/dummy/tmp/cache/assets/DC6/940/sprockets%2Facd26daf8801a48cf5d6b0d441da38d6 +0 -0
  118. data/spec/dummy/tmp/cache/assets/DED/010/sprockets%2F63ff0e07c5aa4b10d7defd921c0cf41d +0 -0
  119. data/spec/dummy/tmp/cache/assets/DFB/070/sprockets%2F827a36ec30d2db41fb4174a9c3dfeffe +0 -0
  120. data/spec/dummy/tmp/cache/assets/DFD/DD0/sprockets%2F20e429deffdda56940cc5c6cab9d73a3 +0 -0
  121. data/spec/dummy/tmp/cache/assets/E89/3E0/sprockets%2Fea640cb8bbbf5cfa9435ddeebd7b42a8 +0 -0
  122. data/spec/dummy/tmp/cache/sass/2d87c55fb19cbf8c06f79a1d11d9921f7ccdf621/bootstrap-responsive.scssc +0 -0
  123. data/spec/dummy/tmp/cache/sass/2d87c55fb19cbf8c06f79a1d11d9921f7ccdf621/bootstrap.scssc +0 -0
  124. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_accordion.scssc +0 -0
  125. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_alerts.scssc +0 -0
  126. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_breadcrumbs.scssc +0 -0
  127. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_button-groups.scssc +0 -0
  128. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_buttons.scssc +0 -0
  129. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_carousel.scssc +0 -0
  130. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_close.scssc +0 -0
  131. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_code.scssc +0 -0
  132. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_component-animations.scssc +0 -0
  133. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_dropdowns.scssc +0 -0
  134. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_forms.scssc +0 -0
  135. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_grid.scssc +0 -0
  136. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_hero-unit.scssc +0 -0
  137. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_labels-badges.scssc +0 -0
  138. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_layouts.scssc +0 -0
  139. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_media.scssc +0 -0
  140. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_mixins.scssc +0 -0
  141. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_modals.scssc +0 -0
  142. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_navbar.scssc +0 -0
  143. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_navs.scssc +0 -0
  144. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_pager.scssc +0 -0
  145. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_pagination.scssc +0 -0
  146. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_popovers.scssc +0 -0
  147. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_progress-bars.scssc +0 -0
  148. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_reset.scssc +0 -0
  149. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-1200px-min.scssc +0 -0
  150. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-767px-max.scssc +0 -0
  151. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-768px-979px.scssc +0 -0
  152. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-navbar.scssc +0 -0
  153. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_responsive-utilities.scssc +0 -0
  154. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_scaffolding.scssc +0 -0
  155. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_sprites.scssc +0 -0
  156. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_tables.scssc +0 -0
  157. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_thumbnails.scssc +0 -0
  158. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_tooltip.scssc +0 -0
  159. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_type.scssc +0 -0
  160. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_utilities.scssc +0 -0
  161. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_variables.scssc +0 -0
  162. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/_wells.scssc +0 -0
  163. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/bootstrap.scssc +0 -0
  164. data/spec/dummy/tmp/cache/sass/90f0768cf7e8daaf11afd7e1e4fcba1811609e39/responsive.scssc +0 -0
  165. data/spec/dummy/tmp/cache/sass/94c49ca37a72afd14b662ec7a424412bc283c3cf/application.css.scssc +0 -0
  166. data/spec/dummy/tmp/cache/sass/a83afe1449c73975e2fd619cb5f810eada3c2894/_font-awesome.sassc +0 -0
  167. data/spec/models/screenshot_actions_spec.rb +126 -0
  168. data/spec/models/screenshots_ignore_url_spec.rb +24 -0
  169. data/spec/models/screenshots_spec.rb +144 -0
  170. data/spec/routing/screenshots_spec.rb +71 -0
  171. data/spec/spec_helper.rb +66 -0
  172. data/spec/support/factories/screenshot.rb +14 -0
  173. data/spec/support/factories/screenshot_ignore_url.rb +5 -0
  174. data/spec/test_screenshots/control/image_1.png +0 -0
  175. data/spec/test_screenshots/control/image_1_small.png +0 -0
  176. data/spec/test_screenshots/control/image_2.png +0 -0
  177. data/spec/test_screenshots/control/image_2_small.png +0 -0
  178. data/spec/test_screenshots/control/image_3.png +0 -0
  179. data/spec/test_screenshots/control/image_3_small.png +0 -0
  180. data/spec/test_screenshots/control/image_4.png +0 -0
  181. data/spec/test_screenshots/control/image_4_small.png +0 -0
  182. data/spec/test_screenshots/control/image_5.png +0 -0
  183. data/spec/test_screenshots/control/image_5_small.png +0 -0
  184. data/spec/test_screenshots/test/image_10.png +0 -0
  185. data/spec/test_screenshots/test/image_10_small.png +0 -0
  186. data/spec/test_screenshots/test/image_6.png +0 -0
  187. data/spec/test_screenshots/test/image_6_small.png +0 -0
  188. data/spec/test_screenshots/test/image_7.png +0 -0
  189. data/spec/test_screenshots/test/image_7_small.png +0 -0
  190. data/spec/test_screenshots/test/image_8.png +0 -0
  191. data/spec/test_screenshots/test/image_8_small.png +0 -0
  192. data/spec/test_screenshots/test/image_9.png +0 -0
  193. data/spec/test_screenshots/test/image_9_small.png +0 -0
  194. metadata +610 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,126 @@
1
+ require 'spec_helper'
2
+ require 'debugger'
3
+
4
+ describe "screenshot functionality actions" do
5
+
6
+ before(:each) {
7
+ # controls
8
+ (1..5).each do |i|
9
+ create_screenshot({:id => i, :is_control => true, :is_test => false})
10
+ end
11
+ # tests
12
+ (6..10).each do |i|
13
+ create_screenshot({:id => i, :is_control => false, :is_test => true})
14
+ end
15
+
16
+ @testing_control_path = "#{UiChanged::Engine.root}/spec/test_screenshots/control/*"
17
+ @testing_test_path = "#{UiChanged::Engine.root}/spec/test_screenshots/test/*"
18
+ @testing_path_map = {"control" => @testing_control_path, "test" => @testing_test_path}
19
+
20
+ @dummy_control_path = "#{UiChanged::ConfigHelper.control_path}"
21
+ @dummy_test_path = "#{UiChanged::ConfigHelper.test_path}"
22
+ @dummy_compare_path = "#{UiChanged::ConfigHelper.compare_path}"
23
+
24
+ # clear out our dummy app screenshot directories
25
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_control_path)
26
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_test_path)
27
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_compare_path)
28
+
29
+ # copy our test screenshots into the dummy directories
30
+ copy_testing_screenshots_into("control", @dummy_control_path)
31
+ copy_testing_screenshots_into("test", @dummy_test_path)
32
+ }
33
+
34
+ after(:each) {
35
+ # clear out our dummy app screenshot directories
36
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_control_path)
37
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_test_path)
38
+ UiChanged::WorkerBase.remove_folder_contents_or_create(@dummy_compare_path)
39
+ }
40
+
41
+ =begin
42
+ # this one isn't working - can't figure it out yet
43
+ it "loads controls with content", :js => true do
44
+ visit "/ui_changed/screenshots/controls"
45
+
46
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(5)
47
+
48
+ all(".f_checkall_child").select.first.set(true)
49
+ all(".f_remove").select.first.click
50
+
51
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(4)
52
+ end
53
+ =end
54
+
55
+ it "should have 5 db control entries" do
56
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(5)
57
+ end
58
+
59
+ it "should have 5 db test entries" do
60
+ UiChanged::Screenshot.where(:is_test => true).count.should eq(5)
61
+ end
62
+
63
+ it "should set all tests as controls" do
64
+ UiChanged::Screenshot.set_all_tests_as_controls
65
+ UiChanged::Screenshot.find(:all).select{|s| s.is_control != true}.should be_empty
66
+
67
+ # there are 2 per screenshot (i.e. image_1.png and image_1_small.png)
68
+ num_files_in_directory(@dummy_control_path).should eq(10)
69
+ num_files_in_directory(@dummy_test_path).should eq(0)
70
+ end
71
+
72
+ it "should set specific tests as controls" do
73
+ UiChanged::Screenshot.set_tests_as_controls([6, 7])
74
+
75
+ UiChanged::Screenshot.where("id IN (?)", [6, 7]).select{|s| s.is_control != true}.should be_empty
76
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(5)
77
+ UiChanged::Screenshot.where(:is_test => true).count.should eq(3)
78
+
79
+ # there are 2 per screenshot (i.e. image_1.png and image_1_small.png)
80
+ num_files_in_directory(@dummy_control_path).should eq(10)
81
+ num_files_in_directory(@dummy_test_path).should eq(6)
82
+ end
83
+
84
+ it "should delete all control images and records" do
85
+ UiChanged::Screenshot.delete_all_controls
86
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(0)
87
+ num_files_in_directory(@dummy_control_path).should eq(0)
88
+ end
89
+
90
+ it "should delete all test images and records" do
91
+ UiChanged::Screenshot.delete_all_tests
92
+ UiChanged::Screenshot.where(:is_test => true).count.should eq(0)
93
+ num_files_in_directory(@dummy_test_path).should eq(0)
94
+ end
95
+
96
+ it "should delete specific ids" do
97
+ # 2 tests & 2 controls
98
+ UiChanged::Screenshot.destroy_entries_and_images([1, 2, 6, 7])
99
+ UiChanged::Screenshot.where(:is_control => true).count.should eq(3)
100
+ UiChanged::Screenshot.where(:is_test => true).count.should eq(3)
101
+ num_files_in_directory(@dummy_control_path).should eq(6)
102
+ num_files_in_directory(@dummy_test_path).should eq(6)
103
+ end
104
+
105
+ end
106
+
107
+ def create_screenshot(params)
108
+ FactoryGirl.create(:screenshot,
109
+ :id => params[:id],
110
+ :url => "http://www.ui_changed_test.com/test#{params[:id].modulo(5)}",
111
+ :image_file_name => "image_#{params[:id]}",
112
+ :is_control => params[:is_control],
113
+ :is_test => params[:is_test])
114
+ end
115
+
116
+ def copy_testing_screenshots_into(type, dir)
117
+ # copy our test screenshots into the dummy test directory
118
+ test_screenshots_path = @testing_path_map[type]
119
+ puts "copying files in #{@test_screenshots_path} to #{dir}"
120
+ FileUtils.cp_r Dir.glob(test_screenshots_path), dir
121
+ end
122
+
123
+ def num_files_in_directory(dir)
124
+ Dir[File.join(dir, '**', '*')].count { |file| File.file?(file) }
125
+ end
126
+
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+ require 'debugger'
3
+
4
+ describe "screenshot ignore url actions" do
5
+
6
+ before(:each) { @screenshot_ignore_url = FactoryGirl.build(:screenshot_ignore_url) }
7
+
8
+ it "should not allow ignore urls that don't start with http or https" do
9
+ @screenshot_ignore_url.url = "badurl://www.google.com"
10
+ @screenshot_ignore_url.should_not be_valid
11
+ @screenshot_ignore_url.should have(1).error_on(:url)
12
+ end
13
+
14
+ it "should allow ignore urls that start with http" do
15
+ @screenshot_ignore_url.url = "http://www.google.com"
16
+ @screenshot_ignore_url.should be_valid
17
+ end
18
+
19
+ it "should allow urls that start with https" do
20
+ @screenshot_ignore_url.url = "https://www.google.com"
21
+ @screenshot_ignore_url.should be_valid
22
+ end
23
+
24
+ end
@@ -0,0 +1,144 @@
1
+ require 'spec_helper'
2
+ require 'debugger'
3
+
4
+ describe "screenshot actions" do
5
+
6
+ # before(:each) { @screenshot = FactoryGirl.create(:screenshot) }
7
+
8
+ # url
9
+
10
+ it "should not allow urls that don't start with http or https" do
11
+ screenshot = build(:screenshot, :url => "badurl://www.google.com")
12
+ screenshot.should_not be_valid
13
+ screenshot.should have(1).error_on(:url)
14
+ end
15
+
16
+ it "should allow urls that start with http" do
17
+ screenshot = build(:screenshot, :url => "http://www.google.com")
18
+ screenshot.should be_valid
19
+ end
20
+
21
+ it "should allow urls that start with https" do
22
+ screenshot = build(:screenshot, :url => "https://www.google.com")
23
+ screenshot.should be_valid
24
+ end
25
+
26
+ # types
27
+
28
+ it "should not allow all three types" do
29
+ build(:screenshot,
30
+ :is_control => true,
31
+ :is_test => true,
32
+ :is_compare => true).should_not be_valid
33
+ end
34
+
35
+ it "should not allow zero types" do
36
+ build(:screenshot,
37
+ :is_control => false,
38
+ :is_test => false,
39
+ :is_compare => false).should_not be_valid
40
+ end
41
+
42
+ it "should only have one type - control" do
43
+ build(:screenshot,
44
+ :is_control => true,
45
+ :is_test => false,
46
+ :is_compare => false).should be_valid
47
+ end
48
+
49
+ it "should only have one type - test" do
50
+ build(:screenshot,
51
+ :is_control => false,
52
+ :is_test => true,
53
+ :is_compare => false).should be_valid
54
+ end
55
+
56
+ it "should only have one type - compare" do
57
+ # we also need to add in the control/test ids for it to validate
58
+ build(:screenshot,
59
+ :is_control => false,
60
+ :is_test => false,
61
+ :is_compare => true,
62
+ :control_id => 1,
63
+ :test_id => 2).should be_valid
64
+ end
65
+
66
+ it "should not validate if is control and diff found" do
67
+ # we also need to add in the control/test ids for it to validate
68
+ build(:screenshot,
69
+ :is_control => true,
70
+ :is_test => false,
71
+ :is_compare => false,
72
+ :diff_found => true,
73
+ :control_id => 1,
74
+ :test_id => 2).should_not be_valid
75
+ end
76
+
77
+ it "should not validate if is test and diff found" do
78
+ build(:screenshot,
79
+ :is_control => false,
80
+ :is_test => true,
81
+ :is_compare => false,
82
+ :diff_found => true,
83
+ :control_id => 1,
84
+ :test_id => 2).should_not be_valid
85
+ end
86
+
87
+ it "should validate if is compare and diff found" do
88
+ build(:screenshot,
89
+ :is_control => false,
90
+ :is_test => false,
91
+ :is_compare => true,
92
+ :diff_found => true,
93
+ :control_id => 1,
94
+ :test_id => 2).should be_valid
95
+ end
96
+
97
+ # control_id / test_id
98
+
99
+ it "should not validate if is compare and control_id and test_id is nil" do
100
+ build(:screenshot,
101
+ :is_control => false,
102
+ :is_test => false,
103
+ :is_compare => true).should_not be_valid
104
+ end
105
+
106
+ it "should not validate if is compare and test_id is nil" do
107
+ build(:screenshot,
108
+ :is_control => false,
109
+ :is_test => false,
110
+ :is_compare => true,
111
+ :control_id => 1).should_not be_valid
112
+ end
113
+
114
+ it "should not validate if is compare and control_id is nil" do
115
+ screenshot = build(:screenshot,
116
+ :is_control => false,
117
+ :is_test => false,
118
+ :is_compare => true,
119
+ :test_id => 1).should_not be_valid
120
+ end
121
+
122
+ it "should validate if is compare and control_id and test_id are populated" do
123
+ screenshot = build(:screenshot,
124
+ :is_control => false,
125
+ :is_test => false,
126
+ :is_compare => true,
127
+ :control_id => 1,
128
+ :test_id => 2).should be_valid
129
+ end
130
+
131
+ # image_content_type
132
+
133
+ it "should not allow image_content_type of doc" do
134
+ screenshot = build(:screenshot, :image_content_type => "doc")
135
+ screenshot.should_not be_valid
136
+ screenshot.should have(1).error_on(:image_content_type)
137
+ end
138
+
139
+ it "should allow image_content_type of png" do
140
+ screenshot = build(:screenshot, :image_content_type => "png")
141
+ screenshot.should be_valid
142
+ end
143
+
144
+ end