hyrax 2.1.0.beta1 → 2.1.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -49
  3. data/.rubocop_fixme.yml +1 -0
  4. data/.travis.yml +1 -1
  5. data/Gemfile +3 -3
  6. data/README.md +4 -2
  7. data/app/actors/hyrax/actors/file_set_actor.rb +0 -1
  8. data/app/actors/hyrax/actors/interpret_visibility_actor.rb +1 -3
  9. data/app/actors/hyrax/actors/model_actor.rb +4 -0
  10. data/app/assets/javascripts/hyrax.js +1 -1
  11. data/app/assets/javascripts/hyrax/app.js.erb +1 -1
  12. data/app/assets/javascripts/hyrax/authority_select.es6 +15 -7
  13. data/app/assets/javascripts/hyrax/collections.js +188 -9
  14. data/app/assets/javascripts/hyrax/content_blocks.js +13 -1
  15. data/app/assets/javascripts/hyrax/editor.es6 +2 -1
  16. data/app/assets/javascripts/hyrax/proxy_rights.js +2 -2
  17. data/app/assets/javascripts/hyrax/turbolinks_events.js +5 -0
  18. data/app/assets/stylesheets/hyrax/_accessibility.scss +21 -0
  19. data/app/assets/stylesheets/hyrax/_catalog.scss +21 -16
  20. data/app/assets/stylesheets/hyrax/_collections.scss +48 -7
  21. data/app/assets/stylesheets/hyrax/_modal.scss +4 -0
  22. data/app/assets/stylesheets/hyrax/_settings.scss +1 -1
  23. data/app/assets/stylesheets/hyrax/dashboard.scss +0 -1
  24. data/app/controllers/concerns/hyrax/breadcrumbs.rb +3 -1
  25. data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +17 -1
  26. data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +10 -0
  27. data/app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb +86 -0
  28. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +14 -11
  29. data/app/controllers/hyrax/admin/collection_types_controller.rb +11 -1
  30. data/app/controllers/hyrax/api/items_controller.rb +2 -6
  31. data/app/controllers/hyrax/batch_edits_controller.rb +6 -0
  32. data/app/controllers/hyrax/batch_uploads_controller.rb +1 -1
  33. data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -7
  34. data/app/controllers/hyrax/dashboard/profiles_controller.rb +2 -0
  35. data/app/controllers/hyrax/dashboard_controller.rb +2 -2
  36. data/app/controllers/hyrax/depositors_controller.rb +19 -0
  37. data/app/controllers/hyrax/downloads_controller.rb +3 -4
  38. data/app/controllers/hyrax/embargoes_controller.rb +2 -0
  39. data/app/controllers/hyrax/file_sets_controller.rb +12 -0
  40. data/app/controllers/hyrax/leases_controller.rb +2 -0
  41. data/app/controllers/hyrax/my/works_controller.rb +9 -0
  42. data/app/controllers/hyrax/my_controller.rb +0 -1
  43. data/app/controllers/hyrax/transfers_controller.rb +1 -3
  44. data/app/controllers/hyrax/users_controller.rb +1 -3
  45. data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
  46. data/app/forms/hyrax/forms/permission_template_form.rb +1 -4
  47. data/app/forms/hyrax/forms/work_form.rb +1 -3
  48. data/app/helpers/hyrax/citations_behaviors/common_behavior.rb +1 -3
  49. data/app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb +1 -5
  50. data/app/helpers/hyrax/collections_helper.rb +7 -4
  51. data/app/helpers/hyrax/file_set_helper.rb +0 -1
  52. data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -1
  53. data/app/helpers/hyrax/trophy_helper.rb +0 -1
  54. data/app/indexers/hyrax/admin_set_indexer.rb +2 -0
  55. data/app/inputs/multi_value_select_input.rb +1 -3
  56. data/app/jobs/attach_files_to_work_job.rb +5 -1
  57. data/app/jobs/import_url_job.rb +9 -8
  58. data/app/models/admin_set.rb +1 -5
  59. data/app/models/concerns/hyrax/ability.rb +3 -4
  60. data/app/models/concerns/hyrax/collection_behavior.rb +0 -4
  61. data/app/models/concerns/hyrax/collection_nesting.rb +12 -0
  62. data/app/models/concerns/hyrax/suppressible.rb +1 -5
  63. data/app/models/featured_work_list.rb +1 -3
  64. data/app/models/hyrax/collection_type.rb +3 -2
  65. data/app/models/hyrax/permission_template_access.rb +6 -4
  66. data/app/models/proxy_deposit_request.rb +1 -1
  67. data/app/presenters/hyrax/collection_presenter.rb +0 -24
  68. data/app/presenters/hyrax/displays_image.rb +1 -1
  69. data/app/presenters/hyrax/file_set_presenter.rb +1 -1
  70. data/app/presenters/hyrax/menu_presenter.rb +1 -1
  71. data/app/presenters/hyrax/work_show_presenter.rb +15 -10
  72. data/app/search_builders/hyrax/abstract_type_relation.rb +2 -1
  73. data/app/search_builders/hyrax/collection_member_search_builder.rb +1 -1
  74. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +3 -1
  75. data/app/search_builders/hyrax/parent_collection_search_builder.rb +2 -2
  76. data/app/services/hyrax/admin_set_create_service.rb +1 -3
  77. data/app/services/hyrax/analytics.rb +1 -3
  78. data/app/services/hyrax/collection_member_service.rb +6 -5
  79. data/app/services/hyrax/collection_types/create_service.rb +37 -10
  80. data/app/services/hyrax/collections/permissions_create_service.rb +1 -3
  81. data/app/services/hyrax/collections/permissions_service.rb +6 -4
  82. data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
  83. data/app/views/catalog/_index_header_list_default.html.erb +1 -1
  84. data/app/views/catalog/_index_list_default.html.erb +6 -10
  85. data/app/views/catalog/_search_form.html.erb +10 -11
  86. data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
  87. data/app/views/catalog/_thumbnail_list_default.html.erb +1 -1
  88. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  89. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +1 -1
  90. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -1
  91. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +3 -3
  92. data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +2 -2
  93. data/app/views/hyrax/admin/admin_sets/index.html.erb +1 -1
  94. data/app/views/hyrax/admin/appearances/show.html.erb +4 -4
  95. data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +3 -2
  96. data/app/views/hyrax/admin/collection_types/index.html.erb +2 -2
  97. data/app/views/hyrax/admin/features/index.html.erb +2 -4
  98. data/app/views/hyrax/admin/stats/_date_form.html.erb +3 -3
  99. data/app/views/hyrax/admin/stats/_top_data.html.erb +1 -1
  100. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  101. data/app/views/hyrax/admin/workflows/index.html.erb +0 -1
  102. data/app/views/hyrax/base/_file_manager_actions.html.erb +2 -2
  103. data/app/views/hyrax/base/_file_manager_member.html.erb +1 -1
  104. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -2
  105. data/app/views/hyrax/base/_form_files.html.erb +3 -3
  106. data/app/views/hyrax/base/_form_member_of_collections.html.erb +1 -2
  107. data/app/views/hyrax/base/_form_progress.html.erb +3 -3
  108. data/app/views/hyrax/base/_form_relationships.html.erb +2 -3
  109. data/app/views/hyrax/base/_form_representative.html.erb +0 -1
  110. data/app/views/hyrax/base/_form_share.html.erb +1 -3
  111. data/app/views/hyrax/base/_form_thumbnail.html.erb +0 -1
  112. data/app/views/hyrax/base/_form_visibility_component.html.erb +6 -6
  113. data/app/views/hyrax/base/_relationships_parent_rows.html.erb +3 -1
  114. data/app/views/hyrax/base/_representative_media.html.erb +1 -1
  115. data/app/views/hyrax/base/_share_with.html.erb +3 -3
  116. data/app/views/hyrax/base/_show_actions.html.erb +14 -1
  117. data/app/views/hyrax/base/_social_media.html.erb +5 -5
  118. data/app/views/hyrax/base/_work_title.erb +3 -1
  119. data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
  120. data/app/views/hyrax/base/inspect_work.html.erb +1 -1
  121. data/app/views/hyrax/base/show.html.erb +2 -2
  122. data/app/views/hyrax/batch_edits/_check_all.html.erb +2 -2
  123. data/app/views/hyrax/batch_edits/edit.html.erb +47 -44
  124. data/app/views/hyrax/batch_select/_add_button.html.erb +2 -2
  125. data/app/views/hyrax/citations/work.html.erb +3 -3
  126. data/app/views/hyrax/collections/_collection.html.erb +1 -1
  127. data/app/views/hyrax/collections/_default_group.html.erb +1 -1
  128. data/app/views/hyrax/collections/_list_collections.html.erb +2 -2
  129. data/app/views/hyrax/collections/_list_works.html.erb +1 -1
  130. data/app/views/hyrax/collections/_show_descriptions.html.erb +6 -6
  131. data/app/views/hyrax/collections/_show_document_list_row.html.erb +2 -2
  132. data/app/views/hyrax/collections/_show_parent_collections.html.erb +11 -38
  133. data/app/views/hyrax/collections/_sort_and_per_page.html.erb +13 -13
  134. data/app/views/hyrax/collections/_subcollection_list.html.erb +1 -1
  135. data/app/views/hyrax/collections/_view_type_group.html.erb +1 -1
  136. data/app/views/hyrax/collections/show.html.erb +122 -122
  137. data/app/views/hyrax/content_blocks/_form.html.erb +13 -12
  138. data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +15 -0
  139. data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +25 -19
  140. data/app/views/hyrax/dashboard/_sidebar.html.erb +1 -1
  141. data/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb +1 -1
  142. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +16 -16
  143. data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -1
  144. data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +11 -11
  145. data/app/views/hyrax/dashboard/collections/_form_default_group_delt.html.erb +1 -1
  146. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +2 -2
  147. data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +4 -4
  148. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +51 -44
  149. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +2 -2
  150. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +4 -4
  151. data/app/views/hyrax/dashboard/collections/_list_works.html.erb +1 -1
  152. data/app/views/hyrax/dashboard/collections/_modal_remove_from_collection.html.erb +10 -5
  153. data/app/views/hyrax/dashboard/collections/_modal_remove_sub_collection.html.erb +10 -5
  154. data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
  155. data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +2 -2
  156. data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +2 -2
  157. data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +10 -5
  158. data/app/views/hyrax/dashboard/collections/_show_parent_collections.html.erb +11 -34
  159. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  160. data/app/views/hyrax/dashboard/collections/_subcollection_list.html.erb +23 -17
  161. data/app/views/hyrax/dashboard/collections/show.html.erb +6 -6
  162. data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +0 -4
  163. data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +16 -14
  164. data/app/views/hyrax/dashboard/profiles/show.html.erb +6 -0
  165. data/app/views/hyrax/dashboard/show_admin.html.erb +19 -3
  166. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +6 -0
  167. data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
  168. data/app/views/hyrax/depositors/index.html.erb +13 -0
  169. data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
  170. data/app/views/hyrax/embargoes/edit.html.erb +47 -35
  171. data/app/views/hyrax/embargoes/index.html.erb +6 -7
  172. data/app/views/hyrax/file_sets/_actions.html.erb +6 -2
  173. data/app/views/hyrax/file_sets/_extra_fields_modal.html.erb +3 -3
  174. data/app/views/hyrax/file_sets/_groups_description.html.erb +0 -1
  175. data/app/views/hyrax/file_sets/_permission_form.html.erb +3 -3
  176. data/app/views/hyrax/file_sets/edit.html.erb +24 -20
  177. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +23 -6
  178. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  179. data/app/views/hyrax/file_sets/media_display/_video.html.erb +23 -6
  180. data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +1 -1
  181. data/app/views/hyrax/leases/edit.html.erb +47 -35
  182. data/app/views/hyrax/leases/index.html.erb +6 -6
  183. data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -1
  184. data/app/views/hyrax/my/_facet_limit.html.erb +1 -2
  185. data/app/views/hyrax/my/_facet_pagination.html.erb +6 -6
  186. data/app/views/hyrax/my/_facet_pivot.html.erb +1 -1
  187. data/app/views/hyrax/my/_results_pagination.html.erb +1 -1
  188. data/app/views/hyrax/my/collections/_facets.html.erb +1 -1
  189. data/app/views/hyrax/my/collections/_list_collections.html.erb +5 -5
  190. data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -2
  191. data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +3 -1
  192. data/app/views/hyrax/my/collections/_modal_add_to_collection_permission_deny.html.erb +1 -1
  193. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +2 -2
  194. data/app/views/hyrax/my/collections/_modal_delete_collection.html.erb +1 -2
  195. data/app/views/hyrax/my/collections/_modal_delete_deny.html.erb +1 -1
  196. data/app/views/hyrax/my/collections/_modal_delete_selected_collections.html.erb +2 -2
  197. data/app/views/hyrax/my/collections/_tabs.html.erb +2 -2
  198. data/app/views/hyrax/my/collections/index.html.erb +7 -3
  199. data/app/views/hyrax/my/facet.html.erb +1 -1
  200. data/app/views/hyrax/my/index.html.erb +6 -2
  201. data/app/views/hyrax/my/works/_facets.html.erb +1 -1
  202. data/app/views/hyrax/my/works/_list_works.html.erb +1 -1
  203. data/app/views/hyrax/my/works/_tabs.html.erb +2 -2
  204. data/app/views/hyrax/my/works/index.html.erb +6 -2
  205. data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
  206. data/app/views/hyrax/pages/_form.html.erb +12 -12
  207. data/app/views/hyrax/pages/show.html.erb +1 -1
  208. data/app/views/hyrax/single_use_links_viewer/show.html.erb +1 -1
  209. data/app/views/hyrax/stats/file.html.erb +6 -2
  210. data/app/views/hyrax/stats/work.html.erb +6 -2
  211. data/app/views/hyrax/transfers/_received.html.erb +6 -6
  212. data/app/views/hyrax/transfers/_sent.html.erb +2 -2
  213. data/app/views/hyrax/transfers/new.html.erb +0 -1
  214. data/app/views/hyrax/users/_activity_log.html.erb +2 -2
  215. data/app/views/hyrax/users/_profile_tabs.html.erb +1 -1
  216. data/app/views/hyrax/users/_search_form.html.erb +1 -1
  217. data/app/views/hyrax/users/_user.html.erb +0 -1
  218. data/app/views/hyrax/users/index.html.erb +1 -1
  219. data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -2
  220. data/app/views/layouts/_head_tag_content.html.erb +2 -2
  221. data/app/views/layouts/error.html.erb +1 -1
  222. data/app/views/layouts/hyrax.html.erb +6 -3
  223. data/app/views/layouts/hyrax/dashboard.html.erb +6 -3
  224. data/app/views/records/show_fields/_based_near.html.erb +0 -1
  225. data/app/views/records/show_fields/_contributor.html.erb +0 -1
  226. data/app/views/records/show_fields/_date_created.html.erb +0 -1
  227. data/app/views/records/show_fields/_description.html.erb +1 -1
  228. data/app/views/records/show_fields/_identifier.html.erb +0 -1
  229. data/app/views/records/show_fields/_language.html.erb +0 -1
  230. data/app/views/records/show_fields/_publisher.html.erb +0 -1
  231. data/app/views/records/show_fields/_related_url.html.erb +0 -1
  232. data/app/views/records/show_fields/_resource_type.html.erb +0 -1
  233. data/app/views/records/show_fields/_subject.html.erb +0 -1
  234. data/app/views/shared/_citations.html.erb +17 -17
  235. data/app/views/shared/_select_work_type_modal.html.erb +2 -2
  236. data/config/locales/hyrax.de.yml +198 -189
  237. data/config/locales/hyrax.en.yml +21 -14
  238. data/config/locales/hyrax.es.yml +9 -0
  239. data/config/locales/hyrax.fr.yml +9 -0
  240. data/config/locales/hyrax.it.yml +9 -0
  241. data/config/locales/hyrax.pt-BR.yml +9 -0
  242. data/config/locales/hyrax.zh.yml +9 -0
  243. data/config/routes.rb +1 -0
  244. data/hyrax.gemspec +7 -18
  245. data/lib/generators/hyrax/models_generator.rb +0 -1
  246. data/lib/generators/hyrax/templates/db/migrate/20180302200051_add_branding_to_collection_type.rb.erb +5 -0
  247. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +1 -1
  248. data/lib/hyrax/configuration.rb +2 -4
  249. data/lib/hyrax/engine.rb +22 -4
  250. data/lib/hyrax/version.rb +1 -1
  251. data/spec/actors/hyrax/actors/lease_actor_spec.rb +16 -0
  252. data/spec/controllers/hyrax/admin/appearances_controller_spec.rb +1 -1
  253. data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +2 -0
  254. data/spec/controllers/hyrax/admin/features_controller_spec.rb +1 -1
  255. data/spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb +1 -1
  256. data/spec/controllers/hyrax/admin/workflows_controller_spec.rb +1 -1
  257. data/spec/controllers/hyrax/batch_edits_controller_spec.rb +14 -1
  258. data/spec/controllers/hyrax/batch_uploads_controller_spec.rb +2 -2
  259. data/spec/controllers/hyrax/citations_controller_spec.rb +4 -2
  260. data/spec/controllers/hyrax/collections_controller_spec.rb +32 -4
  261. data/spec/controllers/hyrax/content_blocks_controller_spec.rb +1 -1
  262. data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +11 -6
  263. data/spec/controllers/hyrax/depositors_controller_spec.rb +11 -0
  264. data/spec/controllers/hyrax/downloads_controller_spec.rb +42 -0
  265. data/spec/controllers/hyrax/embargoes_controller_spec.rb +40 -1
  266. data/spec/controllers/hyrax/file_sets_controller_spec.rb +10 -2
  267. data/spec/controllers/hyrax/generic_works_controller_spec.rb +38 -6
  268. data/spec/controllers/hyrax/leases_controller_spec.rb +11 -0
  269. data/spec/controllers/hyrax/my/collections_controller_spec.rb +1 -1
  270. data/spec/controllers/hyrax/my/works_controller_spec.rb +1 -1
  271. data/spec/controllers/hyrax/pages_controller_spec.rb +1 -1
  272. data/spec/controllers/hyrax/stats_controller_spec.rb +2 -0
  273. data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
  274. data/spec/factories/collection_types.rb +10 -1
  275. data/spec/factories/collections.rb +5 -3
  276. data/spec/factories/collections_factory.rb +3 -3
  277. data/spec/factories/file_sets.rb +2 -6
  278. data/spec/factories/generic_works.rb +68 -4
  279. data/spec/factory_tests/collections_factory_spec.rb +2 -1
  280. data/spec/features/batch_create_spec.rb +60 -0
  281. data/spec/features/batch_edit_spec.rb +1 -0
  282. data/spec/features/browse_dashboard_works_spec.rb +1 -0
  283. data/spec/features/collection_multi_membership_spec.rb +9 -6
  284. data/spec/features/collection_spec.rb +1 -1
  285. data/spec/features/collection_type_spec.rb +49 -1
  286. data/spec/features/create_work_admin_spec.rb +2 -2
  287. data/spec/features/create_work_spec.rb +1 -0
  288. data/spec/features/dashboard/all_works.rb +10 -2
  289. data/spec/features/dashboard/collection_spec.rb +38 -17
  290. data/spec/features/dashboard/display_admin_dashboard_spec.rb +29 -0
  291. data/spec/features/dashboard/display_dashboard_spec.rb +1 -1
  292. data/spec/features/edit_content_block_admin_spec.rb +45 -0
  293. data/spec/features/edit_work_spec.rb +40 -2
  294. data/spec/features/ownership_transfer_spec.rb +1 -0
  295. data/spec/features/proxy_spec.rb +2 -2
  296. data/spec/features/search_spec.rb +2 -5
  297. data/spec/features/work_show_spec.rb +14 -4
  298. data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
  299. data/spec/forms/hyrax/forms/collection_form_spec.rb +1 -1
  300. data/spec/helpers/hyrax/ability_helper_spec.rb +2 -2
  301. data/spec/helpers/hyrax/collections_helper_spec.rb +12 -4
  302. data/spec/javascripts/authority_select_spec.js +1 -1
  303. data/spec/javascripts/settings_spec.js +1 -0
  304. data/spec/jobs/attach_files_to_work_job_spec.rb +13 -0
  305. data/spec/jobs/import_url_job_spec.rb +14 -0
  306. data/spec/models/collection_spec.rb +1 -0
  307. data/spec/models/concerns/hyrax/collection_nesting_spec.rb +16 -0
  308. data/spec/models/hyrax/collection_type_spec.rb +1 -0
  309. data/spec/presenters/hyrax/collection_presenter_spec.rb +1 -100
  310. data/spec/presenters/hyrax/file_set_presenter_spec.rb +17 -2
  311. data/spec/presenters/hyrax/menu_presenter_spec.rb +6 -0
  312. data/spec/presenters/hyrax/work_show_presenter_spec.rb +15 -3
  313. data/spec/search_builders/hyrax/abstract_type_relation_spec.rb +18 -0
  314. data/spec/search_builders/hyrax/dashboard/collections_search_builder_spec.rb +30 -19
  315. data/spec/search_builders/hyrax/parent_collection_search_builder_spec.rb +15 -0
  316. data/spec/services/hyrax/collection_member_service_spec.rb +10 -19
  317. data/spec/services/hyrax/collection_types/create_service_spec.rb +35 -2
  318. data/spec/services/hyrax/collections/collection_member_service_spec.rb +1 -1
  319. data/spec/services/hyrax/qa_select_service_spec.rb +0 -1
  320. data/spec/support/selectors.rb +15 -0
  321. data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +2 -0
  322. data/spec/views/hyrax/admin/collection_types/_form_settings.html.erb_spec.rb +1 -0
  323. data/spec/views/hyrax/admin/stats/show.html.erb_spec.rb +9 -0
  324. data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
  325. data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +13 -1
  326. data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +10 -0
  327. data/spec/views/hyrax/base/show.html.erb_spec.rb +8 -0
  328. data/spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb +3 -53
  329. data/spec/views/hyrax/dashboard/_sidebar.html.erb_spec.rb +22 -0
  330. data/spec/views/hyrax/dashboard/collections/_form_share.erb_spec.rb +2 -1
  331. data/spec/views/hyrax/dashboard/collections/_show_actions.html.erb_spec.rb +13 -0
  332. data/spec/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb_spec.rb +26 -8
  333. data/spec/views/hyrax/dashboard/collections/_show_parent_collections.html.erb_spec.rb +7 -43
  334. data/spec/views/hyrax/dashboard/collections/_subcollection_list.html.erb_spec.rb +13 -1
  335. data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
  336. data/spec/views/hyrax/dashboard/profiles/_trophy_edit.html.erb_spec.rb +36 -0
  337. data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +0 -38
  338. data/spec/views/hyrax/dashboard/profiles/show.html.erb_spec.rb +37 -0
  339. data/spec/views/hyrax/depositors/index.html.erb_spec.rb +13 -0
  340. data/spec/views/hyrax/file_sets/_actions.html.erb_spec.rb +15 -0
  341. data/spec/views/hyrax/file_sets/media_display/_audio.html.erb_spec.rb +29 -0
  342. data/spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb +1 -1
  343. data/spec/views/hyrax/file_sets/media_display/_video.html.erb_spec.rb +29 -0
  344. data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +6 -2
  345. data/tasks/hyrax_dev.rake +1 -3
  346. data/template.rb +1 -1
  347. metadata +49 -41
  348. data/app/assets/javascripts/hyrax/collections_forms.js +0 -108
@@ -0,0 +1,29 @@
1
+ RSpec.describe "The dashboard as viewed by a admin user", type: :feature do
2
+ before do
3
+ sign_in create(:admin)
4
+ end
5
+
6
+ context "upon sign-in" do
7
+ it "shows the admin user's information" do
8
+ expect(page).to have_content "Dashboard"
9
+ expect(page).to have_content "Registered Users"
10
+ expect(page).to have_content "Total Visitors"
11
+ expect(page).to have_content "Returning Visitors"
12
+ expect(page).to have_content "New Visitors"
13
+ expect(page).to have_content "Administrative Sets"
14
+ expect(page).to have_content "Recent activity"
15
+ expect(page).to have_content "Administrative Set"
16
+ expect(page).to have_content "User Activity"
17
+ expect(page).to have_content "Repository Growth"
18
+ expect(page).to have_content "Repository Objects"
19
+
20
+ within '.sidebar' do
21
+ expect(page).to have_link "Works"
22
+ expect(page).to have_link "Collections"
23
+ expect(page).to have_content "Review Submissions"
24
+ expect(page).to have_content "Manage Embargoes"
25
+ expect(page).to have_content "Manage Leases"
26
+ end
27
+ end
28
+ end
29
+ end
@@ -5,7 +5,7 @@ RSpec.describe "The dashboard as viewed by a regular user", type: :feature do
5
5
 
6
6
  context "upon sign-in" do
7
7
  it "shows the user's information" do
8
- expect(page).to have_content "My Dashboard"
8
+ expect(page).to have_content "Dashboard"
9
9
  expect(page).to have_content "User Activity"
10
10
  expect(page).to have_content "User Notifications"
11
11
 
@@ -0,0 +1,45 @@
1
+ RSpec.describe 'Editing content blocks as admin', :js do
2
+ let(:user) { create(:admin) }
3
+
4
+ context 'when user wants to change tabs' do
5
+ let!(:confirm_modal_text) { 'Are you sure you want to leave this tab? Any unsaved data will be lost.' }
6
+
7
+ before do
8
+ sign_in user
9
+ visit '/dashboard'
10
+ click_link 'Settings'
11
+ click_link 'Content Blocks'
12
+ end
13
+
14
+ it "gives a confirmation message" do
15
+ expect(page).to have_content('Content Blocks')
16
+ expect(page).to have_content('Announcement')
17
+ click_link 'Marketing Text'
18
+ within('#change-tab-content-block') do
19
+ expect(page).to have_content(confirm_modal_text)
20
+ end
21
+ end
22
+
23
+ it "changes tab when user accept the changing tab confirmation" do
24
+ expect(page).to have_selector('#announcement_text', class: 'active')
25
+ expect(page).not_to have_selector('#marketing', class: 'active')
26
+ click_link 'Marketing Text'
27
+ within('#change-tab-content-block') do
28
+ click_link('OK')
29
+ end
30
+ expect(page).to have_selector('#marketing', class: 'active')
31
+ expect(page).not_to have_selector('#announcement_text', class: 'active')
32
+ end
33
+
34
+ it "does not change tab when user cancel the changing tab confirmation" do
35
+ expect(page).to have_selector('#announcement_text', class: 'active')
36
+ expect(page).not_to have_selector('#marketing', class: 'active')
37
+ click_link 'Marketing Text'
38
+ within('#change-tab-content-block') do
39
+ click_button('Cancel')
40
+ end
41
+ expect(page).not_to have_selector('#marketing', class: 'active')
42
+ expect(page).to have_selector('#announcement_text', class: 'active')
43
+ end
44
+ end
45
+ end
@@ -1,6 +1,17 @@
1
1
  RSpec.describe 'Editing a work', type: :feature do
2
2
  let(:user) { create(:user) }
3
- let(:work) { build(:work, user: user) }
3
+ let(:work) { build(:work, user: user, admin_set: another_admin_set) }
4
+ let(:default_admin_set) do
5
+ create(:admin_set, id: AdminSet::DEFAULT_ID,
6
+ title: ["Default Admin Set"],
7
+ description: ["A description"],
8
+ edit_users: [user.user_key])
9
+ end
10
+ let(:another_admin_set) do
11
+ create(:admin_set, title: ["Another Admin Set"],
12
+ description: ["A description"],
13
+ edit_users: [user.user_key])
14
+ end
4
15
 
5
16
  before do
6
17
  sign_in user
@@ -10,7 +21,9 @@ RSpec.describe 'Editing a work', type: :feature do
10
21
  end
11
22
 
12
23
  context 'when the user changes permissions' do
13
- it 'confirms copying permissions to files using Hyrax layout' do
24
+ let(:work) { create(:private_work, user: user, admin_set: default_admin_set) }
25
+
26
+ it 'confirms copying permissions to files using Hyrax layout and shows updated value', with_nested_reindexing: true do
14
27
  # e.g. /concern/generic_works/jq085k20z/edit
15
28
  visit edit_hyrax_generic_work_path(work)
16
29
  choose('generic_work_visibility_open')
@@ -18,6 +31,31 @@ RSpec.describe 'Editing a work', type: :feature do
18
31
  click_on('Save')
19
32
  expect(page).to have_content 'Apply changes to contents?'
20
33
  expect(page).not_to have_content "Powered by Hyrax"
34
+ click_on("No. I'll update it manually.")
35
+ within(".panel-heading") do
36
+ expect(page).to have_content('Public')
37
+ end
38
+ end
39
+ end
40
+
41
+ context 'when form loads' do
42
+ before do
43
+ create(:permission_template_access,
44
+ :deposit,
45
+ permission_template: create(:permission_template, source_id: default_admin_set.id, with_admin_set: true, with_active_workflow: true),
46
+ agent_type: 'user',
47
+ agent_id: user.user_key)
48
+ create(:permission_template_access,
49
+ :deposit,
50
+ permission_template: create(:permission_template, source_id: another_admin_set.id, with_admin_set: true, with_active_workflow: true),
51
+ agent_type: 'user',
52
+ agent_id: user.user_key)
53
+ end
54
+
55
+ it 'selects admin set already assigned' do
56
+ visit edit_hyrax_generic_work_path(work)
57
+ click_link "Relationships" # switch tab
58
+ expect(page).to have_select('generic_work_admin_set_id', selected: another_admin_set.title)
21
59
  end
22
60
  end
23
61
  end
@@ -34,6 +34,7 @@ RSpec.describe 'Transferring work ownership:', type: :feature do
34
34
 
35
35
  context 'If the new owner accepts it' do
36
36
  before do
37
+ expect(page).to have_content('Transfer request created')
37
38
  new_owner.proxy_deposit_requests.last.transfer!
38
39
  # refresh the page
39
40
  visit '/dashboard'
@@ -6,8 +6,7 @@ RSpec.describe 'proxy', type: :feature do
6
6
  it "creates a proxy" do
7
7
  sign_in user
8
8
  click_link "Your activity"
9
- click_link "Profile"
10
- click_link "Edit Profile"
9
+ click_link "Manage Proxies"
11
10
  expect(first("td.depositor-name")).to be_nil
12
11
 
13
12
  # BEGIN create_proxy_using_partial
@@ -18,6 +17,7 @@ RSpec.describe 'proxy', type: :feature do
18
17
  # END create_proxy_using_partial
19
18
 
20
19
  expect(page).to have_css('td.depositor-name', text: second_user.user_key)
20
+ expect(page).to have_link('Delete Proxy')
21
21
  end
22
22
  end
23
23
  end
@@ -35,21 +35,18 @@ RSpec.describe 'searching' do
35
35
  # it "does not display search options for dashboard files" do
36
36
  # This section was tested on its own, and required a full setup.
37
37
  within(".input-group-btn") do
38
+ expect(page).not_to have_content("All")
38
39
  expect(page).not_to have_content("My Works")
39
40
  expect(page).not_to have_content("My Collections")
40
41
  expect(page).not_to have_content("My Shares")
41
42
  end
42
- # end
43
43
 
44
- expect(page).to have_content("All")
45
- expect(page).to have_css("a[data-search-label*=All]", visible: false)
44
+ expect(page).not_to have_css("a[data-search-label*=All]", visible: false)
46
45
  expect(page).not_to have_css("a[data-search-label*='My Works']", visible: false)
47
46
  expect(page).not_to have_css("a[data-search-label*='My Collections']", visible: false)
48
47
  expect(page).not_to have_css("a[data-search-label*='My Highlights']", visible: false)
49
48
  expect(page).not_to have_css("a[data-search-label*='My Shares']", visible: false)
50
49
 
51
- click_button("All")
52
- expect(page).to have_content("All of Hyrax")
53
50
  fill_in "search-field-header", with: subject_value
54
51
  click_button("Go")
55
52
 
@@ -7,14 +7,18 @@ RSpec.describe "display a work as its owner" do
7
7
 
8
8
  context "as the work owner" do
9
9
  let(:work) do
10
- create(:work_with_one_file,
10
+ create(:work,
11
11
  with_admin_set: true,
12
- title: ["Magnificent splendor"],
12
+ title: ["Magnificent splendor", "Happy little trees"],
13
13
  source: ["The Internet"],
14
14
  based_near: ["USA"],
15
- user: user)
15
+ user: user,
16
+ ordered_members: [file_set],
17
+ representative_id: file_set.id)
16
18
  end
17
19
  let(:user) { create(:user) }
20
+ let(:file_set) { create(:file_set, user: user, title: ['A Contained FileSet'], content: file) }
21
+ let(:file) { File.open(fixture_path + '/world.png') }
18
22
 
19
23
  before do
20
24
  sign_in user
@@ -23,19 +27,25 @@ RSpec.describe "display a work as its owner" do
23
27
 
24
28
  it "shows a work" do
25
29
  expect(page).to have_selector 'h2', text: 'Magnificent splendor'
30
+ expect(page).to have_selector 'h2', text: 'Happy little trees'
26
31
  expect(page).to have_selector 'li', text: 'The Internet'
27
32
  expect(page).to have_selector 'th', text: 'Location'
28
33
  expect(page).not_to have_selector 'th', text: 'Based near'
34
+ expect(page).to have_selector 'button', text: 'Attach Child', count: 1
29
35
 
30
36
  # Displays FileSets already attached to this work
31
37
  within '.related-files' do
32
38
  expect(page).to have_selector '.attribute-filename', text: 'A Contained FileSet'
33
39
  end
40
+
41
+ # IIIF manifest does not include locale query param
42
+ expect(find('div.viewer:first')['data-uri']).to eq "/concern/generic_works/#{work.id}/manifest"
34
43
  end
35
44
  end
36
45
 
37
46
  context "as a user who is not logged in" do
38
47
  let(:work) { create(:public_generic_work, title: ["Magnificent splendor"], source: ["The Internet"], based_near: ["USA"]) }
48
+ let(:page_title) { { text: "Generic Work | Magnificent splendor | ID: #{work.id} | Hyrax" }.to_param }
39
49
 
40
50
  before do
41
51
  visit work_path
@@ -51,7 +61,7 @@ RSpec.describe "display a work as its owner" do
51
61
  expect(page).not_to have_selector "form#fileupload"
52
62
 
53
63
  # has some social media buttons
54
- expect(page).to have_link '', href: "https://twitter.com/intent/tweet/?text=Magnificent+splendor&url=http%3A%2F%2Fwww.example.com%2Fconcern%2Fgeneric_works%2F#{work.id}"
64
+ expect(page).to have_link '', href: "https://twitter.com/intent/tweet/?#{page_title}&url=http%3A%2F%2Fwww.example.com%2Fconcern%2Fgeneric_works%2F#{work.id}"
55
65
 
56
66
  # exports EndNote
57
67
  expect(page).to have_link 'EndNote'
@@ -7,6 +7,7 @@ RSpec.describe Hyrax::Forms::Admin::CollectionTypeForm do
7
7
  it { is_expected.to delegate_method(:title).to(:collection_type) }
8
8
  it { is_expected.to delegate_method(:description).to(:collection_type) }
9
9
  it { is_expected.to delegate_method(:nestable).to(:collection_type) }
10
+ it { is_expected.to delegate_method(:brandable).to(:collection_type) }
10
11
  it { is_expected.to delegate_method(:sharable).to(:collection_type) }
11
12
  it { is_expected.to delegate_method(:share_applies_to_new_works).to(:collection_type) }
12
13
  it { is_expected.to delegate_method(:require_membership).to(:collection_type) }
@@ -159,7 +159,7 @@ RSpec.describe Hyrax::Forms::CollectionForm do
159
159
  it { is_expected.to be_empty }
160
160
  end
161
161
 
162
- context 'with a work/file attached', :with_nested_reindexing do
162
+ context 'with a work/file attached' do
163
163
  let!(:work) { create(:work_with_one_file, :public, member_of_collections: [collection]) }
164
164
  let(:title) { work.file_sets.first.title.first }
165
165
  let(:file_id) { work.file_sets.first.id }
@@ -6,7 +6,7 @@ RSpec.describe Hyrax::AbilityHelper do
6
6
  Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC =>
7
7
  "<span class=\"label label-success\">Public</span>",
8
8
  Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED =>
9
- "<span class=\"label label-info\">%s</span>",
9
+ "<span class=\"label label-info\">%<name>s</span>",
10
10
  Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE =>
11
11
  "<span class=\"label label-danger\">Private</span>",
12
12
  Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO =>
@@ -17,7 +17,7 @@ RSpec.describe Hyrax::AbilityHelper do
17
17
  context value do
18
18
  let(:visibility) { value }
19
19
 
20
- it { expect(subject).to eql(output % t('hyrax.institution_name')) }
20
+ it { expect(subject).to eql(format(output, name: t('hyrax.institution_name'))) }
21
21
  end
22
22
  end
23
23
  end
@@ -1,4 +1,7 @@
1
1
  RSpec.describe Hyrax::CollectionsHelper do
2
+ let(:user) { create(:user, groups: ['admin']) }
3
+ let(:ability) { Ability.new(user) }
4
+
2
5
  before do
3
6
  # Stub route because helper specs don't handle engine routes
4
7
  # https://github.com/rspec/rspec-rails/issues/1250
@@ -9,9 +12,13 @@ RSpec.describe Hyrax::CollectionsHelper do
9
12
  end
10
13
 
11
14
  describe '#render_collection_links' do
12
- let!(:work_doc) { SolrDocument.new(id: '123', title_tesim: ['My GenericWork']) }
15
+ before do
16
+ allow(controller).to receive(:current_ability).and_return(ability)
17
+ end
13
18
 
14
19
  context 'when a GenericWork does not belongs to any collections', :clean_repo do
20
+ let!(:work_doc) { SolrDocument.new(id: '123', title_tesim: ['My GenericWork']) }
21
+
15
22
  it 'renders nothing' do
16
23
  expect(helper.render_collection_links(work_doc)).to be_nil
17
24
  end
@@ -20,8 +27,9 @@ RSpec.describe Hyrax::CollectionsHelper do
20
27
  context 'when a GenericWork belongs to collections' do
21
28
  let(:coll_ids) { ['111', '222'] }
22
29
  let(:coll_titles) { ['Collection 111', 'Collection 222'] }
23
- let(:coll1_attrs) { { id: coll_ids[0], title_tesim: [coll_titles[0]], child_object_ids_ssim: [work_doc.id] } }
24
- let(:coll2_attrs) { { id: coll_ids[1], title_tesim: [coll_titles[1]], child_object_ids_ssim: [work_doc.id, 'abc123'] } }
30
+ let(:coll1_attrs) { { id: coll_ids[0], title_tesim: [coll_titles[0]] } }
31
+ let(:coll2_attrs) { { id: coll_ids[1], title_tesim: [coll_titles[1]] } }
32
+ let!(:work_doc) { SolrDocument.new(id: '123', title_tesim: ['My GenericWork'], member_of_collection_ids_ssim: coll_ids) }
25
33
 
26
34
  before do
27
35
  ActiveFedora::SolrService.add(coll1_attrs)
@@ -80,7 +88,7 @@ RSpec.describe Hyrax::CollectionsHelper do
80
88
  let(:test_collection_type) { FactoryBot.create(:collection_type) }
81
89
 
82
90
  it "returns the CollectionType title" do
83
- expect(collection_type_label(test_collection_type.gid)).to match %r{^Title \d+$}
91
+ expect(collection_type_label(test_collection_type.gid)).to eq test_collection_type.title
84
92
  end
85
93
  end
86
94
 
@@ -15,7 +15,7 @@ describe('authority select', () => {
15
15
  })
16
16
 
17
17
  it('should change the data-autocomplete-url when you select an authority', () => {
18
- new AuthoritySelect(editor, { selectBox : "select.generic_work_creator", inputField : "input.generic_work_creator" }).initialize()
18
+ new AuthoritySelect({ selectBox : "select.generic_work_creator", inputField : "input.generic_work_creator" })
19
19
  $('select.generic_work_creator').val('/authorities/search/assign_fast/all').change()
20
20
  expect($('input.generic_work_creator').data('autocomplete-url')).toEqual('/authorities/search/assign_fast/all')
21
21
  })
@@ -51,6 +51,7 @@ function settingsForm() {
51
51
  ' <div class="form-inline">' +
52
52
  ' <p><div class="form-group boolean optional collection_type_nestable"><div class="checkbox"><input value="0" type="hidden" name="collection_type[nestable]" /><label class="boolean optional" for="collection_type_nestable"><input class="boolean optional" type="checkbox" value="1" checked="checked" name="collection_type[nestable]" id="collection_type_nestable" />NESTABLE</label></div><p class="help-block">Allow collections of this type to be nested (a collection can contain other collections)</p></div></p>' +
53
53
  ' <p><div class="form-group boolean optional collection_type_discoverable"><div class="checkbox"><input value="0" type="hidden" name="collection_type[discoverable]" /><label class="boolean optional" for="collection_type_discoverable"><input class="boolean optional" type="checkbox" value="1" checked="checked" name="collection_type[discoverable]" id="collection_type_discoverable" />DISCOVERY</label></div><p class="help-block">Allow collections of this type to be discoverable</p></div></p>' +
54
+ ' <p><div class="form-group boolean optional collection_type_brandable"><div class="checkbox"><input value="0" type="hidden" name="collection_type[brandable]" /><label class="boolean optional" for="collection_type_brandable"><input class="boolean optional" type="checkbox" value="1" checked="checked" name="collection_type[brandable]" id="collection_type_brandable" />BRANDABLE</label></div><p class="help-block">Allow collections of this type to be branded</p></div></p>' +
54
55
  ' <p><div class="form-group boolean optional collection_type_sharable"><div class="checkbox"><input value="0" type="hidden" name="collection_type[sharable]" /><label class="boolean optional" for="collection_type_sharable"><input class="boolean optional" type="checkbox" value="1" checked="checked" name="collection_type[sharable]" id="collection_type_sharable" />SHARING</label></div><p class="help-block">Allow users to assign collection managers, depositors, and viewers for collections they manage</p></div></p>' +
55
56
  ' <div class="form-group collection-type-share-applies-to">' +
56
57
  ' <div class="form-group boolean optional collection_type_share_applies_to_new_works"><div class="checkbox"><input value="0" type="hidden" name="collection_type[share_applies_to_new_works]" /><label class="boolean optional" for="collection_type_share_applies_to_new_works"><input class="boolean optional" type="checkbox" value="1" checked="checked" name="collection_type[share_applies_to_new_works]" id="collection_type_share_applies_to_new_works" />APPLY TO NEW WORKS</label></div><p class="help-block">When new works are created directly in the collection, grant sharing users and groups permissions for the new work according to their collection roles.</p></div>' +
@@ -5,6 +5,7 @@ RSpec.describe AttachFilesToWorkJob do
5
5
  let(:uploaded_file1) { build(:uploaded_file, file: file1) }
6
6
  let(:uploaded_file2) { build(:uploaded_file, file: file2) }
7
7
  let(:generic_work) { create(:public_generic_work) }
8
+ let(:user) { create(:user) }
8
9
 
9
10
  shared_examples 'a file attacher' do
10
11
  it 'attaches files, copies visibility and permissions and updates the uploaded files' do
@@ -43,5 +44,17 @@ RSpec.describe AttachFilesToWorkJob do
43
44
 
44
45
  it_behaves_like 'a file attacher'
45
46
  end
47
+
48
+ context "deposited on behalf of another user" do
49
+ before do
50
+ generic_work.on_behalf_of = user.user_key
51
+ generic_work.save
52
+ end
53
+ it_behaves_like 'a file attacher' do
54
+ it 'records the depositor(s) in edit_users' do
55
+ expect(generic_work.file_sets.map(&:edit_users)).to all(match_array([user.user_key]))
56
+ end
57
+ end
58
+ end
46
59
  end
47
60
  end
@@ -29,9 +29,18 @@ RSpec.describe ImportUrlJob do
29
29
  end
30
30
 
31
31
  context 'after running the job' do
32
+ let!(:tmpdir) { Rails.root.join("tmp/spec/#{Process.pid}") }
33
+
32
34
  before do
33
35
  file_set.id = 'abc123'
34
36
  allow(file_set).to receive(:reload)
37
+
38
+ FileUtils.mkdir_p(tmpdir)
39
+ allow(Dir).to receive(:mktmpdir).and_return(tmpdir)
40
+ end
41
+
42
+ after do
43
+ FileUtils.remove_entry(tmpdir)
35
44
  end
36
45
 
37
46
  it 'creates the content and updates the associated operation' do
@@ -39,6 +48,11 @@ RSpec.describe ImportUrlJob do
39
48
  described_class.perform_now(file_set, operation)
40
49
  expect(operation).to be_success
41
50
  end
51
+
52
+ it 'leaves the temp directory in place' do
53
+ described_class.perform_now(file_set, operation)
54
+ expect(File.exist?(File.join(tmpdir, file_hash))).to be true
55
+ end
42
56
  end
43
57
 
44
58
  context "when a batch update job is running too" do
@@ -174,6 +174,7 @@ RSpec.describe Collection, type: :model do
174
174
 
175
175
  it { is_expected.to delegate_method(:nestable?).to(:collection_type) }
176
176
  it { is_expected.to delegate_method(:discoverable?).to(:collection_type) }
177
+ it { is_expected.to delegate_method(:brandable?).to(:collection_type) }
177
178
  it { is_expected.to delegate_method(:sharable?).to(:collection_type) }
178
179
  it { is_expected.to delegate_method(:share_applies_to_new_works?).to(:collection_type) }
179
180
  it { is_expected.to delegate_method(:allow_multiple_membership?).to(:collection_type) }
@@ -6,6 +6,8 @@ RSpec.describe Hyrax::CollectionNesting do
6
6
  include ActiveModel::Validations::Callbacks
7
7
  # Because we need these declared before we include the Hyrax::CollectionNesting
8
8
  define_model_callbacks :destroy, only: :after
9
+ define_model_callbacks :save, only: :after
10
+ define_model_callbacks :save, only: :before
9
11
 
10
12
  def destroy
11
13
  true
@@ -15,6 +17,13 @@ RSpec.describe Hyrax::CollectionNesting do
15
17
  true
16
18
  end
17
19
 
20
+ def before_save
21
+ false
22
+ end
23
+
24
+ def after_save
25
+ true
26
+ end
18
27
  include Hyrax::CollectionNesting
19
28
 
20
29
  attr_accessor :id
@@ -33,6 +42,8 @@ RSpec.describe Hyrax::CollectionNesting do
33
42
 
34
43
  it { is_expected.to callback(:update_nested_collection_relationship_indices).after(:update_index) }
35
44
  it { is_expected.to callback(:update_child_nested_collection_relationship_indices).after(:destroy) }
45
+ it { is_expected.to callback(:before_update_nested_collection_relationship_indices).before(:save) }
46
+ it { is_expected.to callback(:after_update_nested_collection_relationship_indices).after(:save) }
36
47
  it { is_expected.to respond_to(:update_nested_collection_relationship_indices) }
37
48
  it { is_expected.to respond_to(:update_child_nested_collection_relationship_indices) }
38
49
  it { is_expected.to respond_to(:use_nested_reindexing?) }
@@ -43,6 +54,11 @@ RSpec.describe Hyrax::CollectionNesting do
43
54
  expect(Hyrax.config.nested_relationship_reindexer).to receive(:call).with(id: subject.id).and_call_original
44
55
  subject.update_nested_collection_relationship_indices
45
56
  end
57
+
58
+ it 'will not call during save' do
59
+ allow(klass).to receive(:before_save).and_return(true)
60
+ expect(Hyrax.config.nested_relationship_reindexer).not_to receive(:call)
61
+ end
46
62
  end
47
63
  end
48
64