sufia 4.0.0.beta2 → 4.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/README.md +6 -4
  4. data/SUFIA_VERSION +1 -1
  5. data/app/assets/images/folder.png +0 -0
  6. data/app/assets/javascripts/sufia.js +5 -0
  7. data/app/assets/javascripts/sufia/app.js +1 -0
  8. data/app/assets/javascripts/sufia/batch_select_all.js +1 -2
  9. data/app/assets/javascripts/sufia/dashboard_actions.js +13 -0
  10. data/app/assets/javascripts/sufia/editor.js +1 -1
  11. data/app/assets/javascripts/sufia/ga_events.js +10 -0
  12. data/app/assets/javascripts/sufia/search.js +67 -0
  13. data/app/assets/stylesheets/dashboard.css.scss +15 -1
  14. data/app/assets/stylesheets/sufia.css.scss +12 -0
  15. data/app/controllers/authorities_controller.rb +4 -4
  16. data/app/controllers/batch_controller.rb +4 -4
  17. data/app/controllers/collections_controller.rb +44 -0
  18. data/{lib → app/controllers/concerns}/sufia/batch_edits_controller_behavior.rb +1 -1
  19. data/app/controllers/concerns/sufia/catalog.rb +9 -45
  20. data/{lib → app/controllers/concerns}/sufia/controller.rb +11 -21
  21. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +34 -6
  22. data/{lib → app/controllers/concerns}/sufia/downloads_controller_behavior.rb +0 -0
  23. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +35 -0
  24. data/{lib → app/controllers/concerns}/sufia/files_controller/local_ingest_behavior.rb +19 -7
  25. data/{lib → app/controllers/concerns}/sufia/files_controller/upload_complete_behavior.rb +1 -1
  26. data/app/controllers/concerns/sufia/files_controller_behavior.rb +219 -0
  27. data/app/controllers/concerns/sufia/homepage_controller.rb +41 -0
  28. data/app/controllers/concerns/sufia/users_controller_behavior.rb +3 -2
  29. data/app/controllers/dashboard/collections_controller.rb +19 -0
  30. data/app/controllers/dashboard/files_controller.rb +13 -0
  31. data/app/controllers/dashboard/highlights_controller.rb +20 -0
  32. data/app/controllers/dashboard/lists_controller.rb +13 -0
  33. data/app/controllers/dashboard/shares_controller.rb +19 -0
  34. data/app/controllers/directory_controller.rb +8 -8
  35. data/app/controllers/featured_work_lists_controller.rb +1 -1
  36. data/app/controllers/homepage_controller.rb +4 -0
  37. data/app/controllers/single_use_links_controller.rb +6 -6
  38. data/app/controllers/single_use_links_viewer_controller.rb +6 -6
  39. data/app/controllers/static_controller.rb +4 -3
  40. data/app/helpers/batch_edits_helper.rb +3 -6
  41. data/app/helpers/content_block_helper.rb +7 -2
  42. data/app/helpers/generic_file_helper.rb +33 -39
  43. data/app/helpers/records_helper.rb +4 -0
  44. data/app/helpers/sufia/blacklight_override.rb +11 -0
  45. data/app/helpers/sufia/records_helper_behavior.rb +38 -0
  46. data/app/helpers/sufia/sufia_helper_behavior.rb +109 -0
  47. data/{sufia-models/lib/sufia/models → app/models/concerns/sufia}/solr_document_behavior.rb +6 -1
  48. data/app/models/contact_form.rb +13 -13
  49. data/app/uploaders/tinymce_asset_uploader.rb +2 -2
  50. data/app/views/_controls.html.erb +1 -1
  51. data/app/views/_flash_msg.html.erb +2 -8
  52. data/app/views/_ga.html.erb +4 -0
  53. data/app/views/_user_util_links.html.erb +7 -7
  54. data/app/views/advanced/_advanced_search_facets.html.erb +1 -1
  55. data/app/views/advanced/_advanced_search_fields.html.erb +2 -2
  56. data/app/views/advanced/_advanced_search_form.html.erb +12 -12
  57. data/app/views/batch/_metadata.html.erb +12 -12
  58. data/app/views/batch/_more_metadata.html.erb +1 -2
  59. data/app/views/batch/edit.html.erb +5 -5
  60. data/app/views/batch_edits/_check_all.html.erb +1 -1
  61. data/app/views/batch_edits/_delete_selected.html.erb +2 -3
  62. data/app/views/batch_edits/edit.html.erb +20 -21
  63. data/app/views/catalog/_bookmark_control.html.erb +7 -8
  64. data/app/views/catalog/_constraints_element.html.erb +2 -2
  65. data/app/views/catalog/_delete_partials/_default.html.erb +9 -12
  66. data/app/views/catalog/_document.html.erb +5 -5
  67. data/app/views/catalog/_document_list.html.erb +2 -2
  68. data/app/views/catalog/_edit_partials/_default.html.erb +6 -9
  69. data/app/views/catalog/_edit_partials/_default_details.html.erb +2 -4
  70. data/app/views/catalog/_email_form.html.erb +1 -1
  71. data/app/views/catalog/_facet_limit.html.erb +6 -7
  72. data/app/views/catalog/_facet_selected.html.erb +3 -3
  73. data/app/views/catalog/_folder_control.html.erb +7 -8
  74. data/app/views/catalog/_index_default.html.erb +2 -2
  75. data/app/views/catalog/_index_header_default.html.erb +20 -0
  76. data/app/views/catalog/_index_partials/_default_group.html.erb +1 -1
  77. data/app/views/catalog/_index_partials/_list_files.html.erb +5 -2
  78. data/app/views/catalog/_refworks_form.html.erb +2 -2
  79. data/app/views/catalog/_results_pagination.html.erb +1 -1
  80. data/app/views/catalog/_search_form.html.erb +24 -9
  81. data/app/views/catalog/_show_default.html.erb +2 -2
  82. data/app/views/catalog/_show_partials/_default.html.erb +4 -5
  83. data/app/views/catalog/_show_partials/_default_details.html.erb +5 -5
  84. data/app/views/catalog/_show_partials/_facets.html.erb +7 -7
  85. data/app/views/catalog/_show_tools.html.erb +6 -6
  86. data/app/views/catalog/_sms_form.html.erb +1 -1
  87. data/app/views/catalog/_sort_and_per_page.html.erb +8 -14
  88. data/app/views/catalog/citation.html.erb +1 -1
  89. data/app/views/catalog/email.erb +1 -1
  90. data/app/views/catalog/index.html.erb +16 -27
  91. data/app/views/catalog/recent.js.erb +1 -1
  92. data/app/views/catalog/show.html.erb +2 -2
  93. data/app/views/catalog/sms.erb +1 -1
  94. data/app/views/collections/_action_menu.html.erb +24 -0
  95. data/app/views/collections/_batch_edits_actions.html.erb +3 -0
  96. data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
  97. data/app/views/collections/_dashboard_document_list.html.erb +6 -0
  98. data/app/views/collections/_document_list.html.erb +10 -0
  99. data/app/views/collections/_edit_actions.html.erb +5 -0
  100. data/app/views/collections/_edit_descriptions.html.erb +20 -0
  101. data/app/views/collections/_form.html.erb +24 -0
  102. data/app/views/collections/_form_for_select_collection.html.erb +34 -0
  103. data/app/views/collections/_media_display.html.erb +1 -0
  104. data/app/views/collections/_paginate.html.erb +6 -0
  105. data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
  106. data/app/views/collections/_show_actions.html.erb +7 -0
  107. data/app/views/collections/_show_descriptions.html.erb +8 -0
  108. data/app/views/collections/_show_fields.html.erb +0 -0
  109. data/app/views/collections/_single_item_action_fields.html.erb +6 -0
  110. data/app/views/collections/_sort_and_per_page.html.erb +29 -0
  111. data/app/views/collections/_view_type_group.html.erb +13 -0
  112. data/app/views/collections/edit.html.erb +30 -0
  113. data/app/views/collections/show.html.erb +32 -0
  114. data/app/views/contact_form/new.html.erb +13 -13
  115. data/app/views/dashboard/_action_menu.html.erb +29 -0
  116. data/app/views/dashboard/_collection_action_menu.html.erb +15 -0
  117. data/app/views/dashboard/_document_list.html.erb +1 -1
  118. data/app/views/dashboard/_facet_limit.html.erb +2 -2
  119. data/app/views/dashboard/_facet_pagination.html.erb +12 -12
  120. data/app/views/dashboard/_facet_selected.html.erb +2 -2
  121. data/app/views/dashboard/_facets.html.erb +2 -0
  122. data/app/views/dashboard/_index_partials/_default_group.html.erb +9 -2
  123. data/app/views/dashboard/_index_partials/_list_collections.html.erb +45 -0
  124. data/app/views/dashboard/_index_partials/_list_files.html.erb +5 -25
  125. data/app/views/dashboard/_results_pagination.html.erb +1 -1
  126. data/app/views/dashboard/_search_form.html.erb +2 -2
  127. data/app/views/dashboard/_show_partials/_default.html.erb +3 -3
  128. data/app/views/dashboard/_show_partials/_default_details.html.erb +5 -5
  129. data/app/views/dashboard/_show_partials/_facets.html.erb +6 -6
  130. data/app/views/dashboard/_sort_and_per_page.html.erb +24 -8
  131. data/app/views/dashboard/facet.html.erb +3 -3
  132. data/app/views/dashboard/index.html.erb +18 -41
  133. data/app/views/dashboard/lists/index.html.erb +59 -0
  134. data/app/views/generic_files/_breadcrumbs.html.erb +4 -4
  135. data/app/views/generic_files/_descriptions.html.erb +4 -4
  136. data/app/views/generic_files/_field_form.html.erb +5 -5
  137. data/app/views/generic_files/_flot_stats.js.erb +120 -0
  138. data/app/views/generic_files/_media_display.html.erb +14 -4
  139. data/app/views/generic_files/_permission.html.erb +3 -3
  140. data/app/views/generic_files/_permission_form.html.erb +20 -21
  141. data/app/views/generic_files/_show_actions.html.erb +13 -10
  142. data/app/views/generic_files/_show_details.html.erb +16 -9
  143. data/app/views/generic_files/_versioning.html.erb +3 -3
  144. data/app/views/generic_files/edit.html.erb +7 -7
  145. data/app/views/generic_files/edit_fields/_default.html.erb +3 -4
  146. data/app/views/generic_files/edit_fields/_description.html.erb +3 -4
  147. data/app/views/generic_files/edit_fields/_resource_type.html.erb +1 -3
  148. data/app/views/generic_files/edit_fields/_rights.html.erb +3 -5
  149. data/app/views/generic_files/edit_fields/_suffix.html.erb +1 -1
  150. data/app/views/generic_files/show.html.erb +3 -3
  151. data/app/views/generic_files/stats.html.erb +8 -124
  152. data/app/views/generic_files/upload/_alerts.html.erb +2 -4
  153. data/app/views/generic_files/upload/_form.html.erb +1 -1
  154. data/app/views/generic_files/upload/_local_file_import_chooser.html.erb +1 -1
  155. data/app/views/generic_files/upload/_tos_checkbox.html.erb +1 -1
  156. data/app/views/homepage/_featured.html.erb +3 -1
  157. data/app/views/{catalog → homepage}/_featured_researcher.html.erb +0 -0
  158. data/app/views/{catalog → homepage}/_home.html.erb +1 -0
  159. data/app/views/{catalog → homepage}/_home_content.html.erb +4 -4
  160. data/app/views/homepage/_home_header.html.erb +12 -0
  161. data/app/views/homepage/_marketing.html.erb +4 -0
  162. data/app/views/{catalog → homepage}/_recent_document.html.erb +10 -5
  163. data/app/views/homepage/_recents.html.erb +15 -0
  164. data/app/views/homepage/_sortable_featured.html.erb +3 -1
  165. data/app/views/{catalog → homepage}/_tagcloud.html.erb +0 -0
  166. data/app/views/homepage/index.html.erb +1 -0
  167. data/app/views/kaminari/blacklight/_first_page.html.erb +1 -1
  168. data/app/views/kaminari/blacklight/_last_page.html.erb +1 -1
  169. data/app/views/kaminari/blacklight/_next_page.html.erb +1 -1
  170. data/app/views/kaminari/blacklight/_page.html.erb +1 -1
  171. data/app/views/kaminari/blacklight/_prev_page.html.erb +1 -1
  172. data/app/views/layouts/_head_tag_content.html.erb +1 -1
  173. data/app/views/layouts/error.html.erb +2 -2
  174. data/app/views/layouts/homepage.html.erb +4 -4
  175. data/app/views/layouts/sufia-dashboard.html.erb +7 -7
  176. data/app/views/layouts/sufia-one-column.html.erb +4 -4
  177. data/app/views/layouts/sufia-two-column.html.erb +7 -7
  178. data/app/views/mailbox/index.html.erb +2 -2
  179. data/app/views/pages/show.html.erb +1 -0
  180. data/app/views/records/_edit_field.html.erb +18 -0
  181. data/app/views/records/edit_fields/_description.html.erb +10 -0
  182. data/app/views/records/edit_fields/_resource_type.html.erb +7 -0
  183. data/app/views/records/edit_fields/_rights.html.erb +6 -0
  184. data/app/views/records/edit_fields/_suffix.html.erb +9 -0
  185. data/app/views/records/edit_fields/_type.html.erb +13 -0
  186. data/app/views/single_use_links/new_download.html.erb +1 -1
  187. data/app/views/users/_activity.html.erb +1 -1
  188. data/app/views/users/_contributions.html.erb +3 -1
  189. data/app/views/users/_left_sidebar.html.erb +1 -1
  190. data/app/views/users/_notify_link.html.erb +2 -2
  191. data/app/views/users/_profile.html.erb +2 -2
  192. data/app/views/users/_search_form.html.erb +3 -3
  193. data/app/views/users/edit.html.erb +15 -15
  194. data/app/views/users/index.html.erb +3 -3
  195. data/app/views/users/notifications_number.js.erb +1 -1
  196. data/config/locales/sufia.en.yml +13 -2
  197. data/config/routes.rb +56 -20
  198. data/db/seeds.rb +2 -2
  199. data/lib/generators/sufia/sufia_generator.rb +14 -4
  200. data/lib/generators/sufia/templates/catalog_controller.rb +98 -97
  201. data/lib/generators/sufia/templates/sufia_helper.rb +5 -0
  202. data/lib/sufia.rb +4 -0
  203. data/spec/{models/generic_file/actions_spec.rb → actors/generic_file/actor_spec.rb} +2 -2
  204. data/spec/controllers/authorities_controller_spec.rb +7 -7
  205. data/spec/controllers/batch_controller_spec.rb +22 -23
  206. data/spec/controllers/batch_edits_controller_spec.rb +4 -4
  207. data/spec/controllers/catalog_controller_spec.rb +27 -37
  208. data/spec/controllers/collections_controller_spec.rb +179 -0
  209. data/spec/controllers/dashboard/collections_controller_spec.rb +71 -0
  210. data/spec/controllers/dashboard/files_controller_spec.rb +71 -0
  211. data/spec/controllers/dashboard/highlights_controller_spec.rb +66 -0
  212. data/spec/controllers/dashboard/shares_controller_spec.rb +78 -0
  213. data/spec/controllers/dashboard_controller_spec.rb +0 -47
  214. data/spec/controllers/downloads_controller_spec.rb +10 -11
  215. data/spec/controllers/generic_files_controller_spec.rb +147 -118
  216. data/spec/controllers/homepage_controller_spec.rb +57 -0
  217. data/spec/controllers/mailbox_controller_spec.rb +3 -3
  218. data/spec/controllers/single_use_links_viewer_controller_spec.rb +3 -3
  219. data/spec/factories/generic_files.rb +4 -0
  220. data/spec/factories/users.rb +0 -1
  221. data/spec/features/browse_dashboard_files_spec.rb +5 -1
  222. data/spec/features/collection_spec.rb +232 -0
  223. data/spec/features/display_dashboard_spec.rb +1 -0
  224. data/spec/features/notifications_spec.rb +1 -1
  225. data/spec/features/search_spec.rb +22 -0
  226. data/spec/features/single_use_links_spec.rb +2 -2
  227. data/spec/features/users_spec.rb +1 -1
  228. data/spec/fixtures/charter.docx +0 -0
  229. data/spec/helpers/records_helper_spec.rb +61 -0
  230. data/spec/helpers/sufia_helper_spec.rb +40 -2
  231. data/spec/{models → jobs}/active_fedora_pid_based_job_spec.rb +0 -0
  232. data/spec/{models → jobs}/audit_job_spec.rb +0 -2
  233. data/spec/{models → jobs}/batch_update_job_spec.rb +2 -2
  234. data/spec/jobs/characterize_job_spec.rb +25 -0
  235. data/spec/jobs/create_derivatives_job_spec.rb +186 -0
  236. data/spec/{models → jobs}/event_jobs_spec.rb +0 -1
  237. data/spec/jobs/import_url_job_spec.rb +36 -14
  238. data/spec/jobs/ingest_local_file_job_spec.rb +2 -2
  239. data/spec/lib/sufia/analytics_spec.rb +29 -0
  240. data/spec/lib/sufia/upload_complete_behavior_spec.rb +1 -1
  241. data/spec/models/batch_spec.rb +3 -9
  242. data/spec/models/checksum_audit_log_spec.rb +5 -6
  243. data/spec/models/collection_spec.rb +24 -0
  244. data/spec/models/download_spec.rb +21 -0
  245. data/spec/models/featured_work_list_spec.rb +0 -1
  246. data/spec/models/file_content_datastream_spec.rb +8 -14
  247. data/spec/models/file_usage_spec.rb +91 -0
  248. data/spec/models/fits_datastream_spec.rb +1 -1
  249. data/spec/models/generic_file/web_form_spec.rb +2 -2
  250. data/spec/models/generic_file_rdf_datastream_spec.rb +12 -0
  251. data/spec/models/generic_file_spec.rb +150 -168
  252. data/spec/models/local_authority_spec.rb +9 -9
  253. data/spec/models/{pageview.rb → pageview_spec.rb} +0 -0
  254. data/spec/models/single_use_link_spec.rb +32 -35
  255. data/spec/routing/route_spec.rb +19 -3
  256. data/spec/spec_helper.rb +28 -6
  257. data/spec/support/features/session_helpers.rb +5 -6
  258. data/spec/support/lib/generators/test_app_generator.rb +6 -0
  259. data/spec/views/generic_file/edit.html.erb_spec.rb +4 -4
  260. data/spec/views/generic_file/show.html.erb_spec.rb +45 -17
  261. data/spec/views/generic_file/stats.html.erb_spec.rb +26 -7
  262. data/sufia-models/app/actors/sufia/generic_file/actor.rb +98 -0
  263. data/sufia-models/app/models/batch.rb +3 -3
  264. data/sufia-models/app/models/checksum_audit_log.rb +3 -3
  265. data/sufia-models/app/models/collection.rb +41 -0
  266. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file.rb +33 -43
  267. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/accessible_attributes.rb +3 -3
  268. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/audit.rb +12 -18
  269. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/characterization.rb +1 -8
  270. data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +26 -0
  271. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/export.rb +13 -13
  272. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/featured.rb +0 -0
  273. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/metadata.rb +0 -0
  274. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/mime_types.rb +15 -1
  275. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/permissions.rb +5 -1
  276. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/reload_on_save.rb +0 -0
  277. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/trophies.rb +0 -0
  278. data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +16 -0
  279. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/virus_check.rb +2 -3
  280. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/generic_file/web_form.rb +9 -2
  281. data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -4
  282. data/sufia-models/app/models/concerns/sufia/user.rb +2 -2
  283. data/sufia-models/app/models/datastreams/fits_datastream.rb +137 -136
  284. data/sufia-models/app/models/datastreams/generic_file_rdf_datastream.rb +6 -0
  285. data/sufia-models/app/models/datastreams/paranoid_rights_datastream.rb +3 -3
  286. data/sufia-models/app/models/file_usage.rb +53 -0
  287. data/sufia-models/app/models/follow.rb +2 -4
  288. data/sufia-models/app/models/geo_names_resource.rb +5 -7
  289. data/sufia-models/app/models/local_authority.rb +14 -14
  290. data/sufia-models/app/models/single_use_link.rb +1 -1
  291. data/sufia-models/app/models/sufia/download.rb +9 -0
  292. data/sufia-models/app/models/trophy.rb +1 -1
  293. data/sufia-models/app/services/sufia/{usage_statistics.rb → analytics.rb} +1 -24
  294. data/sufia-models/app/services/sufia/id_service.rb +2 -2
  295. data/sufia-models/lib/generators/sufia/models/install_generator.rb +5 -2
  296. data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +1 -1
  297. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +5 -3
  298. data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +6 -6
  299. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +2 -3
  300. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +20 -20
  301. data/sufia-models/lib/sufia/ability.rb +1 -1
  302. data/sufia-models/lib/sufia/models/engine.rb +3 -9
  303. data/sufia-models/lib/sufia/models/file_content/versions.rb +3 -3
  304. data/sufia-models/lib/sufia/models/jobs/active_fedora_pid_based_job.rb +6 -2
  305. data/sufia-models/lib/sufia/models/jobs/batch_update_job.rb +6 -10
  306. data/sufia-models/lib/sufia/models/jobs/characterize_job.rb +1 -13
  307. data/sufia-models/lib/sufia/models/jobs/create_derivatives_job.rb +14 -0
  308. data/sufia-models/lib/sufia/models/jobs/import_url_job.rb +27 -23
  309. data/sufia-models/lib/tasks/sufia-models_tasks.rake +1 -1
  310. data/sufia-models/sufia-models.gemspec +1 -1
  311. data/sufia.gemspec +7 -2
  312. data/tasks/jetty.rake +4 -4
  313. data/tasks/release.rake +8 -8
  314. data/tasks/sufia-db.rake +4 -4
  315. data/tasks/sufia-dev.rake +11 -5
  316. metadata +226 -95
  317. data/app/helpers/sufia_helper.rb +0 -93
  318. data/app/views/catalog/_bookmark_form.html.erb +0 -8
  319. data/app/views/catalog/_home_header.html.erb +0 -15
  320. data/app/views/catalog/_recents.html.erb +0 -17
  321. data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +0 -9
  322. data/app/views/layouts/_homepage_sidebar2.html.erb +0 -14
  323. data/lib/sufia/files_controller_behavior.rb +0 -253
  324. data/spec/helpers/generic_file_helper_spec.rb +0 -28
  325. data/spec/lib/sufia/usage_statistics_spec.rb +0 -75
  326. data/spec/models/characterize_job_spec.rb +0 -93
  327. data/spec/models/transcode_audio_job_spec.rb +0 -85
  328. data/spec/models/transcode_video_job_spec.rb +0 -31
  329. data/spec/views/dashboard/index_partials/_thumbnail_display.html.erb_spec.rb +0 -22
  330. data/sufia-models/lib/sufia/models/generic_file/actions.rb +0 -50
  331. data/sufia-models/lib/sufia/models/generic_file/derivatives.rb +0 -31
  332. data/sufia-models/lib/sufia/models/generic_file/thumbnail.rb +0 -37
  333. data/sufia-models/lib/sufia/models/generic_file/versions.rb +0 -16
  334. data/sufia-models/lib/sufia/models/jobs/transcode_audio_job.rb +0 -15
  335. data/sufia-models/lib/sufia/models/jobs/transcode_video_job.rb +0 -15
@@ -26,23 +26,23 @@ describe LocalAuthority do
26
26
  end
27
27
  it "should harvest an RDF/XML vocab (w/ an alt predicate)" do
28
28
  LocalAuthority.harvest_rdf("langs", @rdfxml,
29
- :format => 'rdfxml',
30
- :predicate => RDF::URI("http://www.w3.org/2008/05/skos#prefLabel"))
29
+ format: 'rdfxml',
30
+ predicate: RDF::URI("http://www.w3.org/2008/05/skos#prefLabel"))
31
31
  LocalAuthority.count.should == 1
32
32
  LocalAuthorityEntry.count.should == 35
33
33
  end
34
34
  it "should harvest TSV vocabs" do
35
- LocalAuthority.harvest_tsv("geo", @tsv, :prefix => 'http://sws.geonames.org/')
35
+ LocalAuthority.harvest_tsv("geo", @tsv, prefix: 'http://sws.geonames.org/')
36
36
  LocalAuthority.count.should == 1
37
- auth = LocalAuthority.where(:name => "geo").first
38
- LocalAuthorityEntry.where(:local_authority_id => auth.id).first.uri.start_with?('http://sws.geonames.org/').should be_true
37
+ auth = LocalAuthority.where(name: "geo").first
38
+ LocalAuthorityEntry.where(local_authority_id: auth.id).first.uri.start_with?('http://sws.geonames.org/').should be_true
39
39
  LocalAuthorityEntry.count.should == 149
40
40
  end
41
41
  describe "when vocabs are harvested" do
42
42
  before(:all) do
43
43
  class MyTestRdfDatastream; end
44
44
  LocalAuthority.harvest_rdf("genres", @nt)
45
- LocalAuthority.harvest_tsv("geo", @tsv, :prefix => 'http://sws.geonames.org/')
45
+ LocalAuthority.harvest_tsv("geo", @tsv, prefix: 'http://sws.geonames.org/')
46
46
  DomainTerm.count.should == 0
47
47
  @num_auths = LocalAuthority.count
48
48
  @num_entries = LocalAuthorityEntry.count
@@ -59,7 +59,7 @@ describe LocalAuthority do
59
59
  LocalAuthorityEntry.count.should == @num_entries
60
60
  end
61
61
  it "should not harvest a TSV vocab twice" do
62
- LocalAuthority.harvest_tsv("geo", @tsv, :prefix => 'http://sws.geonames.org/')
62
+ LocalAuthority.harvest_tsv("geo", @tsv, prefix: 'http://sws.geonames.org/')
63
63
  LocalAuthority.count.should == @num_auths
64
64
  LocalAuthorityEntry.count.should == @num_entries
65
65
  end
@@ -70,7 +70,7 @@ describe LocalAuthority do
70
70
  describe "when vocabs are registered" do
71
71
  before(:all) do
72
72
  LocalAuthority.harvest_rdf("genres", @nt)
73
- LocalAuthority.harvest_tsv("geo", @tsv, :prefix => 'http://sws.geonames.org/')
73
+ LocalAuthority.harvest_tsv("geo", @tsv, prefix: 'http://sws.geonames.org/')
74
74
  class TestRdfDatastream; end
75
75
  LocalAuthority.register_vocabulary(MyTestRdfDatastream, "geographic", "geo")
76
76
  LocalAuthority.register_vocabulary(MyTestRdfDatastream, "genre", "genres")
@@ -91,7 +91,7 @@ describe LocalAuthority do
91
91
  LocalAuthority.entries_by_term("my_test", "foobar", "E").should == []
92
92
  end
93
93
  it "should return entries by term" do
94
- term = DomainTerm.where(:model => "my_tests", :term => "genre").first
94
+ term = DomainTerm.where(model: "my_tests", term: "genre").first
95
95
  authorities = term.local_authorities.collect(&:id).uniq
96
96
  hits = LocalAuthorityEntry.where("local_authority_id in (?)", authorities).where("label like ?", "A%").select("label, uri").limit(25)
97
97
  LocalAuthority.entries_by_term("my_tests", "genre", "A").count.should == 6
@@ -7,66 +7,63 @@ describe SingleUseLink do
7
7
  @file.save
8
8
  end
9
9
 
10
- after (:all) do
11
- @file.delete
10
+ after(:all) do
11
+ @file.destroy
12
12
  end
13
13
 
14
- let(:file) do
15
- @file
16
- end
17
-
14
+ let(:file) { @file }
15
+
18
16
  describe "create" do
19
17
  before do
20
- @now = DateTime.now
21
- DateTime.stub(:now).and_return(@now)
22
- @hash = "sha2hash"+@now.to_f.to_s
23
- Digest::SHA2.should_receive(:new).and_return(@hash)
24
-
18
+ @now = DateTime.now
19
+ DateTime.stub(:now).and_return(@now)
20
+ @hash = "sha2hash#{@now.to_f.to_s}"
21
+ Digest::SHA2.should_receive(:new).and_return(@hash)
25
22
  end
26
23
  it "should create show link" do
27
- su = SingleUseLink.create itemId: file.pid, path: Sufia::Engine.routes.url_helpers.generic_file_path(file.pid)
28
- su.downloadKey.should == @hash
29
- su.itemId.should == file.pid
30
- su.path.should == Sufia::Engine.routes.url_helpers.generic_file_path(file.pid)
31
- su.delete
32
- end
24
+ su = SingleUseLink.create itemId: file.pid, path: Sufia::Engine.routes.url_helpers.generic_file_path(file.pid)
25
+ su.downloadKey.should == @hash
26
+ su.itemId.should == file.pid
27
+ su.path.should == Sufia::Engine.routes.url_helpers.generic_file_path(file.pid)
28
+ su.delete
29
+ end
33
30
  it "should create show download link" do
34
- su = SingleUseLink.create itemId: file.pid, path: Sufia::Engine.routes.url_helpers.download_path(file.pid)
35
- su.downloadKey.should == @hash
36
- su.itemId.should == file.pid
37
- su.path.should == Sufia::Engine.routes.url_helpers.download_path(file.pid)
38
- su.delete
39
- end
31
+ su = SingleUseLink.create itemId: file.pid, path: Sufia::Engine.routes.url_helpers.download_path(file.pid)
32
+ su.downloadKey.should == @hash
33
+ su.itemId.should == file.pid
34
+ su.path.should == Sufia::Engine.routes.url_helpers.download_path(file.pid)
35
+ su.delete
36
+ end
40
37
  end
41
38
  describe "find" do
42
39
  describe "not expired" do
43
40
  before do
44
- @su = SingleUseLink.create(downloadKey:'sha2hashb', itemId:file.pid, path:Sufia::Engine.routes.url_helpers.download_path(file.noid), expires:DateTime.now.advance(:hours => 1))
41
+ @su = SingleUseLink.create(downloadKey: 'sha2hashb', itemId: file.pid, path: Sufia::Engine.routes.url_helpers.download_path(file.noid), expires: DateTime.now.advance(hours: 1))
45
42
  end
46
43
  it "should retrieve link" do
47
- link = SingleUseLink.where(downloadKey:'sha2hashb').first
44
+ link = SingleUseLink.where(downloadKey: 'sha2hashb').first
48
45
  link.itemId.should == file.pid
49
- end
46
+ end
50
47
  it "should retrieve link with find_by" do
51
48
  link = SingleUseLink.find_by_downloadKey('sha2hashb')
52
49
  link.itemId.should == file.pid
53
- end
50
+ end
54
51
  it "should expire link" do
55
- link = SingleUseLink.where(downloadKey:'sha2hashb').first
56
- link.expired?.should == false
57
- end
52
+ link = SingleUseLink.where(downloadKey: 'sha2hashb').first
53
+ link.expired?.should == false
54
+ end
58
55
  end
59
56
  describe "expired" do
60
57
  before do
61
- @su = SingleUseLink.create!(downloadKey:'sha2hashb', itemId:file.pid, path:Sufia::Engine.routes.url_helpers.download_path(file.noid))
58
+ @su = SingleUseLink.create!(downloadKey: 'sha2hashb', itemId:file.pid, path:Sufia::Engine.routes.url_helpers.download_path(file.noid))
62
59
 
63
- @su.update_attribute :expires, DateTime.now.advance(:hours => -1)
60
+ @su.update_attribute :expires, DateTime.now.advance(hours: -1)
64
61
  end
65
62
 
66
63
  it "should expire link" do
67
- link = SingleUseLink.where(downloadKey:'sha2hashb').first
68
- link.expired?.should == true
64
+ link = SingleUseLink.where(downloadKey: 'sha2hashb').first
65
+ link.expired?.should == true
69
66
  end
70
- end
67
+ end
71
68
  end
72
69
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe 'Routes' do
4
4
  routes { Sufia::Engine.routes }
5
5
 
6
- describe 'Catalog' do
7
- it 'should route the root url to the catalog controller' do
8
- { get: '/' }.should route_to(controller: 'catalog', action: 'index')
6
+ describe 'Homepage' do
7
+ it 'should route the root url to the homepage controller' do
8
+ { get: '/' }.should route_to(controller: 'homepage', action: 'index')
9
9
  end
10
10
  end
11
11
 
@@ -72,6 +72,22 @@ describe 'Routes' do
72
72
  { get: '/dashboard' }.should route_to(controller: 'dashboard', action: 'index')
73
73
  end
74
74
 
75
+ it "should route to dashboard files tab" do
76
+ { get: '/dashboard/files' }.should route_to(controller: 'dashboard/files', action: 'index')
77
+ end
78
+
79
+ it "should route to dashboard collections tab" do
80
+ { get: '/dashboard/collections' }.should route_to(controller: 'dashboard/collections', action: 'index')
81
+ end
82
+
83
+ it "should route to dashboard highlighted tab" do
84
+ { get: '/dashboard/highlights' }.should route_to(controller: 'dashboard/highlights', action: 'index')
85
+ end
86
+
87
+ it "should route to dashboard shared tab" do
88
+ { get: '/dashboard/shares' }.should route_to(controller: 'dashboard/shares', action: 'index')
89
+ end
90
+
75
91
  it "should route to dashboard facet" do
76
92
  { get: '/dashboard/facet/1' }.should route_to(controller: 'dashboard', action: 'facet', id: '1')
77
93
  end
@@ -2,14 +2,21 @@
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
3
 
4
4
  require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../internal", __FILE__))
5
+
6
+ require 'database_cleaner'
7
+
5
8
  require 'rspec/rails'
6
9
  require 'rspec/autorun'
10
+ require 'capybara/poltergeist'
11
+ Capybara.javascript_driver = :poltergeist
12
+ Capybara.default_wait_time = ENV['TRAVIS'] ? 30 : 15
7
13
  require 'capybara/rspec'
8
14
  require 'capybara/rails'
9
15
  require 'equivalent-xml/rspec_matchers'
10
16
 
11
17
  require File.expand_path('../support/features', __FILE__)
12
18
 
19
+
13
20
  if ENV['COVERAGE']
14
21
  require 'simplecov'
15
22
  SimpleCov.start 'rails'
@@ -69,19 +76,34 @@ RSpec.configure do |config|
69
76
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
70
77
  config.fixture_path = File.expand_path("../fixtures", __FILE__)
71
78
 
72
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
73
- # examples within a transaction, remove the following line or assign false
74
- # instead of true.
75
- config.use_transactional_fixtures = true
79
+ config.use_transactional_fixtures = false
80
+
81
+ config.before :each do
82
+ if Capybara.current_driver == :rack_test
83
+ DatabaseCleaner.strategy = :transaction
84
+ else
85
+ DatabaseCleaner.strategy = :truncation
86
+ end
87
+ DatabaseCleaner.start
88
+ end
89
+
90
+ config.after do
91
+ DatabaseCleaner.clean
92
+ end
93
+
76
94
 
77
95
  # If true, the base class of anonymous controllers will be inferred
78
96
  # automatically. This will be the default behavior in future versions of
79
97
  # rspec-rails.
80
98
  config.infer_base_class_for_anonymous_controllers = false
81
99
 
82
- config.include Devise::TestHelpers, :type => :controller
83
- config.include EngineRoutes, :type => :controller
100
+ config.include Devise::TestHelpers, type: :controller
101
+ config.include EngineRoutes, type: :controller
84
102
  config.include EquivalentXml::RSpecMatchers
103
+
104
+ config.include Warden::Test::Helpers, type: :feature
105
+ config.after(:each, type: :feature) { Warden.test_reset! }
106
+
85
107
  end
86
108
 
87
109
  module FactoryGirl
@@ -11,19 +11,18 @@ module Features
11
11
  end
12
12
 
13
13
  def sign_in(who = :user)
14
- if who.instance_of?(User)
15
- user = who
14
+ user = if who.instance_of?(User)
15
+ who
16
16
  else
17
- user = FactoryGirl.find_or_create(who)
18
- if user.password.nil? # get the password from the factory if user was retrieved from database
19
- tmpl = FactoryGirl.build(who)
20
- user.password = tmpl.password
17
+ FactoryGirl.build(:user).tap do |u|
18
+ u.save!
21
19
  end
22
20
  end
23
21
  visit new_user_session_path
24
22
  fill_in 'Email', with: user.email
25
23
  fill_in 'Password', with: user.password
26
24
  click_button 'Sign in'
25
+ expect(page).to_not have_text 'Invalid email or password.'
27
26
  end
28
27
  end
29
28
  end
@@ -22,6 +22,11 @@ class TestAppGenerator < Rails::Generators::Base
22
22
  end
23
23
  end
24
24
 
25
+ def enable_analytics
26
+ gsub_file "config/initializers/sufia.rb",
27
+ "config.analytics = false", "config.analytics = true"
28
+ end
29
+
25
30
  def add_sufia_assets
26
31
  insert_into_file 'app/assets/stylesheets/application.css', after: ' *= require_self' do
27
32
  "\n *= require sufia"
@@ -30,4 +35,5 @@ class TestAppGenerator < Rails::Generators::Base
30
35
  gsub_file 'app/assets/javascripts/application.js',
31
36
  '//= require_tree .', '//= require sufia'
32
37
  end
38
+
33
39
  end
@@ -3,11 +3,11 @@ require 'spec_helper'
3
3
  describe 'generic_files/edit.html.erb' do
4
4
  describe 'when the file has two or more resource types' do
5
5
  let(:generic_file) {
6
- content = double('content', versions: [])
6
+ content = double('content', versions: [], mimeType: 'application/pdf')
7
7
  stub_model(GenericFile, noid: '123',
8
- depositor: 'bob',
9
- resource_type: ['Book', 'Dataset'],
10
- content: content)
8
+ depositor: 'bob',
9
+ resource_type: ['Book', 'Dataset'],
10
+ content: content)
11
11
  }
12
12
 
13
13
  before do
@@ -1,25 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'generic_files/show.html.erb' do
4
- describe 'usage statistics' do
5
- let(:generic_file) {
6
- content = double('content', versions: [])
7
- stub_model(GenericFile, noid: '123',
8
- depositor: 'bob',
9
- audit_stat: 1,
10
- content: content)
11
- }
12
-
13
- before do
14
- allow(controller).to receive(:current_user).and_return(stub_model(User))
15
- allow_any_instance_of(Ability).to receive(:can?).and_return(true)
16
- assign(:generic_file, generic_file)
17
- assign(:events, [])
18
- end
4
+ let(:generic_file) {
5
+ content = double('content', versions: [], mimeType: 'application/pdf')
6
+ stub_model(GenericFile, noid: '123',
7
+ depositor: 'bob',
8
+ audit_stat: 1,
9
+ content: content)
10
+ }
11
+
12
+ before do
13
+ allow(controller).to receive(:current_user).and_return(stub_model(User))
14
+ allow_any_instance_of(Ability).to receive(:can?).and_return(true)
15
+ assign(:generic_file, generic_file)
16
+ assign(:events, [])
17
+ end
18
+
19
+ describe 'analytics' do
19
20
 
20
21
  context 'when enabled' do
21
22
  before do
22
- Sufia.config.usage_statistics = true
23
+ Sufia.config.analytics = true
23
24
  end
24
25
 
25
26
  it 'appears on page' do
@@ -31,7 +32,7 @@ describe 'generic_files/show.html.erb' do
31
32
 
32
33
  context 'when disabled' do
33
34
  before do
34
- Sufia.config.usage_statistics = false
35
+ Sufia.config.analytics = false
35
36
  end
36
37
 
37
38
  it 'does not appear on page' do
@@ -41,4 +42,31 @@ describe 'generic_files/show.html.erb' do
41
42
  end
42
43
  end
43
44
  end
45
+
46
+ describe 'featured' do
47
+
48
+ context "public file" do
49
+ before do
50
+ allow(generic_file).to receive(:public?).and_return(true)
51
+ end
52
+
53
+ it "shows featured feature link for public file" do
54
+ render
55
+ page = Capybara::Node::Simple.new(rendered)
56
+ expect(page).to have_selector('a[data-behavior="feature"]', count: 1)
57
+ end
58
+ end
59
+
60
+ context "non public file" do
61
+ before do
62
+ allow(generic_file).to receive(:public?).and_return(false)
63
+ end
64
+
65
+ it "does not show feature link for non public file" do
66
+ render
67
+ page = Capybara::Node::Simple.new(rendered)
68
+ expect(page).to have_no_selector('a[data-behavior="feature"]', count: 1)
69
+ end
70
+ end
71
+ end
44
72
  end
@@ -4,13 +4,33 @@ describe 'generic_files/stats.html.erb' do
4
4
  describe 'usage statistics' do
5
5
  let(:generic_file) {
6
6
  stub_model(GenericFile, noid: '123',
7
- title: 'file1.txt')
7
+ title: ['file1.txt'])
8
+ }
9
+
10
+ let(:no_stats) {
11
+ allow_message_expectations_on_nil
12
+ allow(FileUsage).to receive(:new)
13
+ stub_model(FileUsage,
14
+ created: Date.parse('2014-01-01'),
15
+ total_pageviews: 0,
16
+ total_downloads: 0,
17
+ to_flot: []
18
+ )
19
+ }
20
+
21
+ let(:stats) {
22
+ allow(FileUsage).to receive(:new)
23
+ stub_model(FileUsage,
24
+ created: Date.parse('2014-01-01'),
25
+ total_pageviews: 9,
26
+ total_downloads: 4,
27
+ to_flot: [[1396422000000,2],[1396508400000,3],[1396594800000,4]]
28
+ )
8
29
  }
9
30
 
10
31
  before do
11
32
  assign(:generic_file, generic_file)
12
- assign(:created, Date.parse('2014-01-01'))
13
- assign(:stats_json, [].to_json)
33
+ assign(:stats, no_stats)
14
34
  end
15
35
 
16
36
  it 'shows breadcrumbs' do
@@ -27,20 +47,19 @@ describe 'generic_files/stats.html.erb' do
27
47
  it 'shows 0 visits' do
28
48
  render
29
49
  page = Capybara::Node::Simple.new(rendered)
30
- expect(page).to have_selector('div.alert-info', text: /0 views since January 1, 2014/i, count: 1)
50
+ expect(page).to have_selector('div.alert-info', text: /0 views and 0 downloads since January 1, 2014/i, count: 1)
31
51
  end
32
52
  end
33
53
 
34
54
  context 'when results are returned' do
35
55
  before do
36
- assign(:stats_json, [[1396422000000,2],[1396508400000,3],[1396594800000,4]].to_json)
37
- assign(:pageviews, 9)
56
+ assign(:stats, stats)
38
57
  end
39
58
 
40
59
  it 'shows visits' do
41
60
  render
42
61
  page = Capybara::Node::Simple.new(rendered)
43
- expect(page).to have_selector('div.alert-info', text: /9 views since January 1, 2014/i, count: 1)
62
+ expect(page).to have_selector('div.alert-info', text: /9 views and 4 downloads since January 1, 2014/i, count: 1)
44
63
  end
45
64
  end
46
65
  end