curation_concerns 1.6.3 → 1.7.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.travis.yml +2 -8
  4. data/README.md +27 -1
  5. data/app/actors/curation_concerns/actors/base_actor.rb +2 -3
  6. data/app/actors/curation_concerns/actors/file_set_actor.rb +1 -1
  7. data/app/actors/curation_concerns/actors/grant_edit_to_depositor_actor.rb +19 -0
  8. data/app/actors/curation_concerns/actors/initialize_workflow_actor.rb +19 -0
  9. data/app/assets/javascripts/curation_concerns/charts.js +47 -0
  10. data/app/assets/javascripts/curation_concerns/curation_concerns.js +2 -0
  11. data/app/assets/javascripts/curation_concerns/workflow_actions_affix.js +11 -0
  12. data/app/assets/stylesheets/curation_concerns/_admin.scss +18 -0
  13. data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +1 -0
  14. data/app/assets/stylesheets/curation_concerns/_positioning.scss +11 -0
  15. data/app/controllers/concerns/curation_concerns/act_as_admin_controller.rb +25 -0
  16. data/app/controllers/concerns/curation_concerns/admin_controller_behavior.rb +38 -0
  17. data/app/controllers/concerns/curation_concerns/admin_page.rb +18 -0
  18. data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +3 -2
  19. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +158 -159
  20. data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +4 -6
  21. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +2 -1
  22. data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +4 -6
  23. data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +2 -1
  24. data/app/controllers/curation_concerns/admin/workflow_roles_controller.rb +36 -0
  25. data/app/controllers/curation_concerns/workflow_actions_controller.rb +25 -0
  26. data/app/conversions/power_converters/polymorphic_type.rb +7 -0
  27. data/app/conversions/power_converters/sipity_action.rb +9 -0
  28. data/app/conversions/power_converters/sipity_action_name.rb +8 -0
  29. data/app/conversions/power_converters/sipity_agent.rb +6 -0
  30. data/app/conversions/power_converters/sipity_entity.rb +12 -0
  31. data/app/conversions/power_converters/sipity_role.rb +8 -0
  32. data/app/conversions/power_converters/sipity_workflow_id.rb +16 -0
  33. data/app/conversions/power_converters/sipity_workflow_state.rb +10 -0
  34. data/app/conversions/power_converters.rb +6 -0
  35. data/app/forms/curation_concerns/forms/workflow_action_form.rb +62 -0
  36. data/app/forms/curation_concerns/forms/workflow_responsibility_form.rb +42 -0
  37. data/app/helpers/curation_concerns/charts_helper.rb +23 -0
  38. data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
  39. data/app/helpers/curation_concerns/url_helper.rb +2 -5
  40. data/app/indexers/curation_concerns/indexes_workflow.rb +44 -0
  41. data/app/indexers/curation_concerns/work_indexer.rb +1 -2
  42. data/app/jobs/import_export_job.rb +46 -0
  43. data/app/models/concerns/curation_concerns/ability.rb +2 -0
  44. data/app/models/concerns/curation_concerns/permissions/writable.rb +7 -8
  45. data/app/models/concerns/curation_concerns/publishable.rb +6 -0
  46. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +8 -0
  47. data/app/models/concerns/curation_concerns/user.rb +5 -0
  48. data/app/models/curation_concerns/group.rb +23 -0
  49. data/app/models/curation_concerns/workflow_action_info.rb +13 -0
  50. data/app/models/sipity/agent.rb +21 -0
  51. data/app/models/sipity/comment.rb +13 -0
  52. data/app/models/sipity/entity.rb +32 -0
  53. data/app/models/sipity/entity_specific_responsibility.rb +21 -0
  54. data/app/models/sipity/method.rb +5 -0
  55. data/app/models/sipity/notifiable_context.rb +26 -0
  56. data/app/models/sipity/notification.rb +28 -0
  57. data/app/models/sipity/notification_recipient.rb +17 -0
  58. data/app/models/sipity/role.rb +43 -0
  59. data/app/models/sipity/workflow.rb +19 -0
  60. data/app/models/sipity/workflow_action.rb +25 -0
  61. data/app/models/sipity/workflow_responsibility.rb +23 -0
  62. data/app/models/sipity/workflow_role.rb +13 -0
  63. data/app/models/sipity/workflow_state.rb +26 -0
  64. data/app/models/sipity/workflow_state_action.rb +9 -0
  65. data/app/models/sipity/workflow_state_action_permission.rb +8 -0
  66. data/app/models/vocab/fedora_resource_status.rb +4 -1
  67. data/app/presenters/curation_concerns/admin/workflow_role_presenter.rb +40 -0
  68. data/app/presenters/curation_concerns/work_show_presenter.rb +4 -0
  69. data/app/presenters/curation_concerns/workflow_presenter.rb +43 -0
  70. data/app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb +1 -1
  71. data/app/search_builders/curation_concerns/search_filters.rb +0 -1
  72. data/app/services/curation_concerns/actors/actor_factory.rb +3 -1
  73. data/app/services/curation_concerns/admin_set_service.rb +13 -4
  74. data/app/services/curation_concerns/work_form_service.rb +11 -0
  75. data/app/services/curation_concerns/workflow/action_taken_service.rb +57 -0
  76. data/app/services/curation_concerns/workflow/activate_object.rb +9 -0
  77. data/app/services/curation_concerns/workflow/deactivate_object.rb +11 -0
  78. data/app/services/curation_concerns/workflow/default_workflow_strategy.rb +13 -0
  79. data/app/services/curation_concerns/workflow/method_generator.rb +55 -0
  80. data/app/services/curation_concerns/workflow/notification_configuration_parameter.rb +42 -0
  81. data/app/services/curation_concerns/workflow/notification_generator.rb +64 -0
  82. data/app/services/curation_concerns/workflow/notification_service.rb +66 -0
  83. data/app/services/curation_concerns/workflow/permission_generator.rb +95 -0
  84. data/app/services/curation_concerns/workflow/permission_query.rb +432 -0
  85. data/app/services/curation_concerns/workflow/remove_depositor_permissions.rb +11 -0
  86. data/app/services/curation_concerns/workflow/sipity_actions_generator.rb +49 -0
  87. data/app/services/curation_concerns/workflow/state_machine_generator.rb +102 -0
  88. data/app/services/curation_concerns/workflow/status_list_service.rb +52 -0
  89. data/app/services/curation_concerns/workflow/workflow_action_service.rb +56 -0
  90. data/app/services/curation_concerns/workflow/workflow_by_model_name_strategy.rb +14 -0
  91. data/app/services/curation_concerns/workflow/workflow_factory.rb +64 -0
  92. data/app/services/curation_concerns/workflow/workflow_importer.rb +103 -0
  93. data/app/services/curation_concerns/workflow/workflow_permissions_generator.rb +49 -0
  94. data/app/services/curation_concerns/workflow/workflow_schema.rb +56 -0
  95. data/app/services/rights_service.rb +1 -1
  96. data/app/services/sipity.rb +2 -0
  97. data/app/sources/curation_concerns/resource_statistics_source.rb +101 -0
  98. data/app/values/curation_concerns/chart_data.rb +61 -0
  99. data/app/views/curation_concerns/admin/_admin_menu.html.erb +5 -0
  100. data/app/views/curation_concerns/admin/_resource_stats.html.erb +43 -0
  101. data/app/views/curation_concerns/admin/_sidebar.html.erb +3 -0
  102. data/app/views/curation_concerns/admin/_total_embargo_visibility.html.erb +21 -0
  103. data/app/views/curation_concerns/admin/_total_objects.html.erb +1 -0
  104. data/app/views/curation_concerns/admin/_total_objects_charts.html.erb +12 -0
  105. data/app/views/curation_concerns/admin/index.html.erb +11 -0
  106. data/app/views/curation_concerns/admin/widgets/_pie.html.erb +1 -0
  107. data/app/views/curation_concerns/admin/workflow.html.erb +31 -0
  108. data/app/views/curation_concerns/admin/workflow_roles/index.html.erb +45 -0
  109. data/app/views/curation_concerns/base/_form_rights.html.erb +1 -1
  110. data/app/views/curation_concerns/base/_workflow_actions.html.erb +39 -0
  111. data/app/views/curation_concerns/base/show.html.erb +2 -0
  112. data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +0 -1
  113. data/app/views/layouts/_head_tag_content.html.erb +13 -0
  114. data/app/views/layouts/admin.html.erb +10 -0
  115. data/app/views/shared/_my_actions.html.erb +4 -1
  116. data/config/initializers/precompile_assets.rb +1 -0
  117. data/config/locales/curation_concerns.en.yml +97 -56
  118. data/config/routes.rb +7 -0
  119. data/curation_concerns.gemspec +9 -3
  120. data/db/migrate/20160919151348_create_sipity.rb +163 -0
  121. data/db/migrate/20161012182404_create_sipity_workflow_methods.rb +10 -0
  122. data/lib/curation_concerns/configuration.rb +68 -0
  123. data/lib/curation_concerns/engine.rb +9 -1
  124. data/lib/curation_concerns/rails/routes.rb +1 -0
  125. data/lib/curation_concerns/version.rb +1 -1
  126. data/lib/curation_concerns.rb +1 -1
  127. data/lib/generators/curation_concerns/admin_dashboard_generator.rb +15 -0
  128. data/lib/generators/curation_concerns/install_generator.rb +7 -0
  129. data/lib/generators/curation_concerns/sample_data_generator.rb +12 -0
  130. data/lib/generators/curation_concerns/templates/app/controllers/curation_concerns/admin_controller.rb +61 -0
  131. data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -3
  132. data/lib/generators/curation_concerns/templates/config/curation_concerns.rb +39 -0
  133. data/lib/generators/curation_concerns/templates/db/seeds.rb +94 -0
  134. data/lib/generators/curation_concerns/templates/spec/models/collection_spec.rb +1 -1
  135. data/lib/generators/curation_concerns/templates/spec/models/file_set_spec.rb +1 -1
  136. data/lib/generators/curation_concerns/templates/workflow.json.erb +19 -0
  137. data/lib/generators/curation_concerns/work/USAGE +1 -0
  138. data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +1 -1
  139. data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +1 -1
  140. data/lib/generators/curation_concerns/work/templates/feature_spec.rb.erb +1 -1
  141. data/lib/generators/curation_concerns/work/templates/form_spec.rb.erb +1 -1
  142. data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +1 -1
  143. data/spec/abilities/admin_ability_spec.rb +15 -0
  144. data/spec/actors/curation_concerns/file_set_actor_spec.rb +24 -0
  145. data/spec/actors/curation_concerns/grant_edit_to_depositor_actor_spec.rb +32 -0
  146. data/spec/actors/curation_concerns/initialize_workflow_actor_spec.rb +33 -0
  147. data/spec/actors/curation_concerns/interpret_visibility_actor_spec.rb +1 -0
  148. data/spec/actors/curation_concerns/work_actor_spec.rb +10 -5
  149. data/spec/controllers/curation_concerns/acts_as_admin_controller_spec.rb +22 -0
  150. data/spec/controllers/curation_concerns/admin/workflow_roles_controller_spec.rb +26 -0
  151. data/spec/controllers/curation_concerns/admin_controller_spec.rb +64 -0
  152. data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +11 -3
  153. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +4 -4
  154. data/spec/controllers/curation_concerns/workflow_actions_controller_spec.rb +36 -0
  155. data/spec/conversions/power_converters/polymorphic_type_spec.rb +22 -0
  156. data/spec/conversions/power_converters/sipity_action_name_spec.rb +32 -0
  157. data/spec/conversions/power_converters/sipity_action_spec.rb +43 -0
  158. data/spec/conversions/power_converters/sipity_agent_spec.rb +20 -0
  159. data/spec/conversions/power_converters/sipity_entity_spec.rb +46 -0
  160. data/spec/conversions/power_converters/sipity_role_spec.rb +33 -0
  161. data/spec/conversions/power_converters/sipity_workflow_id_spec.rb +28 -0
  162. data/spec/conversions/power_converters/sipity_workflow_state_spec.rb +22 -0
  163. data/spec/factories/generic_works.rb +19 -6
  164. data/spec/factories/sipity_entities.rb +7 -0
  165. data/spec/factories/workflow_actions.rb +6 -0
  166. data/spec/factories/workflow_states.rb +6 -0
  167. data/spec/factories/workflows.rb +5 -0
  168. data/spec/features/admin_spec.rb +14 -0
  169. data/spec/features/create_child_work_spec.rb +1 -1
  170. data/spec/features/create_work_spec.rb +1 -1
  171. data/spec/features/embargo_spec.rb +1 -1
  172. data/spec/features/lease_spec.rb +1 -1
  173. data/spec/features/work_generator_spec.rb +2 -2
  174. data/spec/features/workflow_roles_spec.rb +48 -0
  175. data/spec/forms/curation_concerns/forms/workflow_action_form_spec.rb +111 -0
  176. data/spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb +33 -0
  177. data/spec/helpers/curation_concerns/charts_helper_spec.rb +62 -0
  178. data/spec/helpers/url_helper_spec.rb +11 -11
  179. data/spec/indexers/work_indexer_spec.rb +13 -1
  180. data/spec/javascripts/charts_spec.coffee +10 -0
  181. data/spec/javascripts/fixtures/chart_example.html +1 -0
  182. data/spec/jobs/import_export_job_spec.rb +28 -0
  183. data/spec/models/curation_concerns/group_spec.rb +15 -0
  184. data/spec/models/file_set_spec.rb +6 -2
  185. data/spec/models/generic_work_spec.rb +12 -0
  186. data/spec/models/sipity/agent_spec.rb +9 -0
  187. data/spec/models/sipity/comment_spec.rb +16 -0
  188. data/spec/models/sipity/entity_spec.rb +27 -0
  189. data/spec/models/sipity/entity_specific_responsibility_spec.rb +8 -0
  190. data/spec/models/sipity/notifiable_context_spec.rb +8 -0
  191. data/spec/models/sipity/notification_recipient_spec.rb +10 -0
  192. data/spec/models/sipity/notification_spec.rb +15 -0
  193. data/spec/models/sipity/role_spec.rb +30 -0
  194. data/spec/models/sipity/workflow_action_spec.rb +10 -0
  195. data/spec/models/sipity/workflow_responsibility_spec.rb +7 -0
  196. data/spec/models/sipity/workflow_role_spec.rb +7 -0
  197. data/spec/models/sipity/workflow_spec.rb +15 -0
  198. data/spec/models/sipity/workflow_state_action_permission_spec.rb +7 -0
  199. data/spec/models/sipity/workflow_state_action_spec.rb +7 -0
  200. data/spec/models/sipity/workflow_state_spec.rb +7 -0
  201. data/spec/models/user_spec.rb +12 -1
  202. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +12 -1
  203. data/spec/presenters/curation_concerns/workflow_presenter_spec.rb +39 -0
  204. data/spec/routing/route_spec.rb +13 -0
  205. data/spec/services/curation_concerns/admin_set_service_spec.rb +13 -0
  206. data/spec/services/curation_concerns/qa_select_service_spec.rb +75 -0
  207. data/spec/services/curation_concerns/workflow/action_taken_service_spec.rb +76 -0
  208. data/spec/services/curation_concerns/workflow/activate_object_spec.rb +20 -0
  209. data/spec/services/curation_concerns/workflow/deactivate_object_spec.rb +20 -0
  210. data/spec/services/curation_concerns/workflow/method_generator_spec.rb +43 -0
  211. data/spec/services/curation_concerns/workflow/notification_configuration_parameter_spec.rb +25 -0
  212. data/spec/services/curation_concerns/workflow/notification_generator_spec.rb +27 -0
  213. data/spec/services/curation_concerns/workflow/notification_service_spec.rb +81 -0
  214. data/spec/services/curation_concerns/workflow/permission_generator_spec.rb +52 -0
  215. data/spec/services/curation_concerns/workflow/permission_query_spec.rb +179 -0
  216. data/spec/services/curation_concerns/workflow/remove_depositor_permissions_spec.rb +21 -0
  217. data/spec/services/curation_concerns/workflow/sipity_actions_generator_spec.rb +30 -0
  218. data/spec/services/curation_concerns/workflow/state_machine_generator_spec.rb +46 -0
  219. data/spec/services/curation_concerns/workflow/status_list_service_spec.rb +46 -0
  220. data/spec/services/curation_concerns/workflow/workflow_importer_spec.rb +50 -0
  221. data/spec/services/curation_concerns/workflow/workflow_permissions_generator_spec.rb +37 -0
  222. data/spec/services/curation_concerns/workflow/workflow_schema_spec.rb +85 -0
  223. data/spec/sources/curation_concerns/resource_statistics_source_spec.rb +137 -0
  224. data/spec/spec_helper.rb +8 -1
  225. data/spec/test_app_templates/lib/generators/test_app_generator.rb +11 -0
  226. data/spec/views/curation_concerns/admin/_admin_menu.html.erb_spec.rb +23 -0
  227. data/spec/views/curation_concerns/admin/_resource_stats.html.erb_spec.rb +33 -0
  228. data/spec/views/curation_concerns/admin/_total_objects_charts.html.erb_spec.rb +28 -0
  229. data/spec/views/curation_concerns/admin/index.html.erb_spec.rb +26 -0
  230. data/spec/views/curation_concerns/admin/widgets/_pie.html.erb_spec.rb +17 -0
  231. data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +1 -1
  232. data/spec/views/curation_concerns/base/show.html.erb_spec.rb +33 -0
  233. data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +1 -1
  234. data/spec/views/shared/_my_actions.html.erb_spec.rb +1 -0
  235. data/tasks/workflow.rake +8 -0
  236. metadata +335 -21
@@ -20,4 +20,15 @@ class TestAppGenerator < Rails::Generators::Base
20
20
  remove_file 'spec/controllers/curation_concerns/generic_works_controller_spec.rb'
21
21
  remove_file 'spec/actors/curation_concerns/generic_work_actor_spec.rb'
22
22
  end
23
+
24
+ def copy_fixture_data
25
+ generate 'curation_concerns:sample_data', '-f'
26
+ end
27
+
28
+ def enable_i18n_translation_errors
29
+ gsub_file "config/environments/development.rb",
30
+ "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
31
+ gsub_file "config/environments/test.rb",
32
+ "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
33
+ end
23
34
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe "admin_menu.html.erb" do
4
+ let(:configuration) do
5
+ {
6
+ menu: {
7
+ index: {}
8
+ }
9
+ }
10
+ end
11
+ before do
12
+ allow(view).to receive(:action_name).and_return(:index)
13
+ render partial: "curation_concerns/admin/admin_menu", locals: { configuration: configuration }
14
+ end
15
+ context "when there's an item in the index menu" do
16
+ it "makes a link to the right action" do
17
+ expect(rendered).to have_link "Admin Dashboard", href: curation_concerns.admin_index_path
18
+ end
19
+ it "marks the current page as active" do
20
+ expect(rendered).to have_selector "li.active > a"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'curation_concerns/admin/_resource_stats.html.erb', type: :view do
4
+ let(:resource_stats) do
5
+ instance_double(CurationConcerns::ResourceStatisticsSource,
6
+ open_concerns_count: 25,
7
+ authenticated_concerns_count: 300,
8
+ restricted_concerns_count: 777,
9
+ expired_embargo_now_authenticated_concerns_count: 66,
10
+ expired_embargo_now_open_concerns_count: 77,
11
+ active_embargo_now_authenticated_concerns_count: 88,
12
+ active_embargo_now_restricted_concerns_count: 99,
13
+ expired_lease_now_authenticated_concerns_count: 6666,
14
+ expired_lease_now_restricted_concerns_count: 7777,
15
+ active_lease_now_authenticated_concerns_count: 8888,
16
+ active_lease_now_open_concerns_count: 9999)
17
+ end
18
+
19
+ it "renders without error" do
20
+ render partial: "curation_concerns/admin/resource_stats", locals: { resource_stats: resource_stats }
21
+ expect(rendered).to have_content("Open Access25")
22
+ expect(rendered).to have_content("Institution Name300")
23
+ expect(rendered).to have_content("Private777")
24
+ expect(rendered).to have_content("Embargo (Expired, Authenticated)66")
25
+ expect(rendered).to have_content("Embargo (Expired, Open)77")
26
+ expect(rendered).to have_content("Embargo (Active, Authenticated)88")
27
+ expect(rendered).to have_content("Embargo (Active, Restricted)99")
28
+ expect(rendered).to have_content("Lease (Active, Authenticated)8888")
29
+ expect(rendered).to have_content("Lease (Active, Open)9999")
30
+ expect(rendered).to have_content("Lease (Expired, Authenticated)6666")
31
+ expect(rendered).to have_content("Lease (Expired, Restricted)7777")
32
+ end
33
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'curation_concerns/admin/_total_objects_charts.html.erb', type: :view do
4
+ before do
5
+ allow(view).to receive(:action_name).and_return(:index)
6
+ assign(:resource_statistics, resource_stats)
7
+ stub_template 'curation_concerns/admin/widgets/_pie.html.erb' => 'Mine 1'
8
+ end
9
+ let(:resource_stats) do
10
+ instance_double(CurationConcerns::ResourceStatisticsSource,
11
+ open_concerns_count: 25,
12
+ authenticated_concerns_count: 300,
13
+ restricted_concerns_count: 777,
14
+ expired_embargo_now_authenticated_concerns_count: 66,
15
+ expired_embargo_now_open_concerns_count: 77,
16
+ active_embargo_now_authenticated_concerns_count: 88,
17
+ active_embargo_now_restricted_concerns_count: 99,
18
+ expired_lease_now_authenticated_concerns_count: 6666,
19
+ expired_lease_now_restricted_concerns_count: 7777,
20
+ active_lease_now_authenticated_concerns_count: 8888,
21
+ active_lease_now_open_concerns_count: 9999)
22
+ end
23
+
24
+ it "renders without error" do
25
+ render
26
+ expect(rendered).to have_content("Mine 1")
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'curation_concerns/admin/index.html.erb', type: :view do
4
+ before do
5
+ assign(:configuration, configuration)
6
+ allow(view).to receive(:action_name).and_return(:index)
7
+ stub_template 'curation_concerns/admin/_my_view_1.html.erb' => 'Mine 1'
8
+ stub_template 'curation_concerns/admin/_my_view_2.html.erb' => 'Another One'
9
+ end
10
+ let(:configuration) do
11
+ { actions: {
12
+ index: {
13
+ partials: [
14
+ "my_view_1",
15
+ "my_view_2"
16
+ ]
17
+ }
18
+ } }
19
+ end
20
+
21
+ it "renders all the partials" do
22
+ render
23
+ expect(rendered).to have_content("Mine 1")
24
+ expect(rendered).to have_content("Another One")
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe "_pie.html.erb" do
4
+ let(:data) { { mine: 1, yours: 0 } }
5
+ before do
6
+ render "curation_concerns/admin/widgets/pie", data: data, label: 'my_pie'
7
+ end
8
+
9
+ it "makes a div with data and class" do
10
+ expect(rendered).to have_css "div#my_pie-stats-pie.stats-pie"
11
+ expect(rendered).to have_selector 'div[data-series]'
12
+ expect(rendered).to have_selector 'div[data-label]'
13
+ text = rendered.to_s
14
+ expect(text).to include 'data-series="{&quot;drilldown&quot;:{&quot;series&quot;:[]},&quot;series&quot;:[{&quot;name&quot;:&quot;mine&quot;,&quot;y&quot;:1},{&quot;name&quot;:&quot;yours&quot;,&quot;y&quot;:0}]}"'
15
+ expect(text).to include 'data-label="my_pie_data"'
16
+ end
17
+ end
@@ -31,7 +31,7 @@ RSpec.describe "curation_concerns/base/file_manager.html.erb" do
31
31
  SolrDocument.new(parent.to_solr.merge(id: "resource"), nil)
32
32
  end
33
33
  let(:parent_presenter) do
34
- CurationConcerns::WorkShowPresenter.new(parent_solr_doc, nil)
34
+ CurationConcerns::WorkShowPresenter.new(parent_solr_doc, nil, view)
35
35
  end
36
36
 
37
37
  let(:blacklight_config) { CatalogController.new.blacklight_config }
@@ -17,11 +17,16 @@ describe 'curation_concerns/base/show.html.erb' do
17
17
  )
18
18
  }
19
19
 
20
+ let(:entity) { instance_double(Sipity::Entity, workflow_state_name: 'pending') }
20
21
  let(:ability) { nil }
21
22
  let(:presenter) do
22
23
  CurationConcerns::WorkShowPresenter.new(solr_document, ability)
23
24
  end
24
25
 
26
+ before do
27
+ allow(PowerConverter).to receive(:convert).and_return(entity)
28
+ end
29
+
25
30
  context 'for editors' do
26
31
  before do
27
32
  allow(view).to receive(:can?).with(:edit, String).and_return(true)
@@ -30,13 +35,41 @@ describe 'curation_concerns/base/show.html.erb' do
30
35
  assign(:presenter, presenter)
31
36
  render
32
37
  end
38
+ let(:header_node) do
39
+ header_content = view.view_flow.content[:page_header]
40
+ Capybara::Node::Simple.new(header_content)
41
+ end
33
42
 
34
43
  it 'draws the page' do
44
+ expect(header_node).to have_selector '.state.state-pending', text: 'pending'
35
45
  expect(rendered).to have_link 'Attribution 3.0 United States', href: 'http://creativecommons.org/licenses/by/3.0/us/'
36
46
  expect(rendered).to have_link 'Edit This Generic Work', href: edit_polymorphic_path(presenter)
37
47
  end
38
48
  end
39
49
 
50
+ context 'with parent_presenter' do
51
+ before do
52
+ allow(view).to receive(:can?).with(:edit, String).and_return(true)
53
+ allow(view).to receive(:can?).with(:collect, String).and_return(true)
54
+ allow(view).to receive(:collection_options_for_select)
55
+ assign(:presenter, presenter)
56
+ assign(:parent_presenter, parent_presenter)
57
+ allow(parent_presenter).to receive(:to_s).and_return("Parent Work")
58
+ render
59
+ end
60
+ let(:parent_presenter) do
61
+ CurationConcerns::WorkShowPresenter.new(solr_document, ability)
62
+ end
63
+ let(:header_node) do
64
+ header_content = view.view_flow.content[:page_header]
65
+ Capybara::Node::Simple.new(header_content)
66
+ end
67
+
68
+ it 'draws the page' do
69
+ expect(header_node).to have_selector '.breadcrumb', text: 'Parent Work'
70
+ end
71
+ end
72
+
40
73
  context 'for non-editors' do
41
74
  before do
42
75
  assign(:presenter, presenter)
@@ -16,7 +16,7 @@ describe 'curation_concerns/permissions/confirm.html.erb' do
16
16
  end
17
17
 
18
18
  context 'when the work is leased' do
19
- let(:curation_concern) { build(:leased_work, embargo_date: '2099-09-26'.to_date) }
19
+ let(:curation_concern) { build(:leased_work, lease_date: '2099-09-26'.to_date) }
20
20
 
21
21
  it 'has a message about leases' do
22
22
  expect(rendered).to have_content "You've applied a lease to this Generic Work, Test title, changing its visibility to Open Access until September 26th, 2099. Would you like to apply the same lease to all of the files within the Generic Work as well?"
@@ -18,6 +18,7 @@ describe 'shared/_my_actions.html.erb' do
18
18
  expect(rendered).to have_link("My Collections", href: search_path_for_my_collections)
19
19
  expect(rendered).to have_link("Embargos", href: embargoes_path)
20
20
  expect(rendered).to have_link("Leases", href: leases_path)
21
+ expect(rendered).to have_link("Admin Dashboard", href: curation_concerns.admin_index_path)
21
22
  end
22
23
  end
23
24
 
@@ -0,0 +1,8 @@
1
+ namespace :curation_concerns do
2
+ namespace :workflow do
3
+ desc "Load workflow configuration into the database"
4
+ task load: :environment do
5
+ CurationConcerns::Workflow::WorkflowImporter.load_workflows
6
+ end
7
+ end
8
+ end