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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +2 -8
- data/README.md +27 -1
- data/app/actors/curation_concerns/actors/base_actor.rb +2 -3
- data/app/actors/curation_concerns/actors/file_set_actor.rb +1 -1
- data/app/actors/curation_concerns/actors/grant_edit_to_depositor_actor.rb +19 -0
- data/app/actors/curation_concerns/actors/initialize_workflow_actor.rb +19 -0
- data/app/assets/javascripts/curation_concerns/charts.js +47 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +2 -0
- data/app/assets/javascripts/curation_concerns/workflow_actions_affix.js +11 -0
- data/app/assets/stylesheets/curation_concerns/_admin.scss +18 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +1 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +11 -0
- data/app/controllers/concerns/curation_concerns/act_as_admin_controller.rb +25 -0
- data/app/controllers/concerns/curation_concerns/admin_controller_behavior.rb +38 -0
- data/app/controllers/concerns/curation_concerns/admin_page.rb +18 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +3 -2
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +158 -159
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +4 -6
- data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +2 -1
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +4 -6
- data/app/controllers/concerns/curation_concerns/single_use_links_viewer_controller_behavior.rb +2 -1
- data/app/controllers/curation_concerns/admin/workflow_roles_controller.rb +36 -0
- data/app/controllers/curation_concerns/workflow_actions_controller.rb +25 -0
- data/app/conversions/power_converters/polymorphic_type.rb +7 -0
- data/app/conversions/power_converters/sipity_action.rb +9 -0
- data/app/conversions/power_converters/sipity_action_name.rb +8 -0
- data/app/conversions/power_converters/sipity_agent.rb +6 -0
- data/app/conversions/power_converters/sipity_entity.rb +12 -0
- data/app/conversions/power_converters/sipity_role.rb +8 -0
- data/app/conversions/power_converters/sipity_workflow_id.rb +16 -0
- data/app/conversions/power_converters/sipity_workflow_state.rb +10 -0
- data/app/conversions/power_converters.rb +6 -0
- data/app/forms/curation_concerns/forms/workflow_action_form.rb +62 -0
- data/app/forms/curation_concerns/forms/workflow_responsibility_form.rb +42 -0
- data/app/helpers/curation_concerns/charts_helper.rb +23 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
- data/app/helpers/curation_concerns/url_helper.rb +2 -5
- data/app/indexers/curation_concerns/indexes_workflow.rb +44 -0
- data/app/indexers/curation_concerns/work_indexer.rb +1 -2
- data/app/jobs/import_export_job.rb +46 -0
- data/app/models/concerns/curation_concerns/ability.rb +2 -0
- data/app/models/concerns/curation_concerns/permissions/writable.rb +7 -8
- data/app/models/concerns/curation_concerns/publishable.rb +6 -0
- data/app/models/concerns/curation_concerns/solr_document_behavior.rb +8 -0
- data/app/models/concerns/curation_concerns/user.rb +5 -0
- data/app/models/curation_concerns/group.rb +23 -0
- data/app/models/curation_concerns/workflow_action_info.rb +13 -0
- data/app/models/sipity/agent.rb +21 -0
- data/app/models/sipity/comment.rb +13 -0
- data/app/models/sipity/entity.rb +32 -0
- data/app/models/sipity/entity_specific_responsibility.rb +21 -0
- data/app/models/sipity/method.rb +5 -0
- data/app/models/sipity/notifiable_context.rb +26 -0
- data/app/models/sipity/notification.rb +28 -0
- data/app/models/sipity/notification_recipient.rb +17 -0
- data/app/models/sipity/role.rb +43 -0
- data/app/models/sipity/workflow.rb +19 -0
- data/app/models/sipity/workflow_action.rb +25 -0
- data/app/models/sipity/workflow_responsibility.rb +23 -0
- data/app/models/sipity/workflow_role.rb +13 -0
- data/app/models/sipity/workflow_state.rb +26 -0
- data/app/models/sipity/workflow_state_action.rb +9 -0
- data/app/models/sipity/workflow_state_action_permission.rb +8 -0
- data/app/models/vocab/fedora_resource_status.rb +4 -1
- data/app/presenters/curation_concerns/admin/workflow_role_presenter.rb +40 -0
- data/app/presenters/curation_concerns/work_show_presenter.rb +4 -0
- data/app/presenters/curation_concerns/workflow_presenter.rb +43 -0
- data/app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb +1 -1
- data/app/search_builders/curation_concerns/search_filters.rb +0 -1
- data/app/services/curation_concerns/actors/actor_factory.rb +3 -1
- data/app/services/curation_concerns/admin_set_service.rb +13 -4
- data/app/services/curation_concerns/work_form_service.rb +11 -0
- data/app/services/curation_concerns/workflow/action_taken_service.rb +57 -0
- data/app/services/curation_concerns/workflow/activate_object.rb +9 -0
- data/app/services/curation_concerns/workflow/deactivate_object.rb +11 -0
- data/app/services/curation_concerns/workflow/default_workflow_strategy.rb +13 -0
- data/app/services/curation_concerns/workflow/method_generator.rb +55 -0
- data/app/services/curation_concerns/workflow/notification_configuration_parameter.rb +42 -0
- data/app/services/curation_concerns/workflow/notification_generator.rb +64 -0
- data/app/services/curation_concerns/workflow/notification_service.rb +66 -0
- data/app/services/curation_concerns/workflow/permission_generator.rb +95 -0
- data/app/services/curation_concerns/workflow/permission_query.rb +432 -0
- data/app/services/curation_concerns/workflow/remove_depositor_permissions.rb +11 -0
- data/app/services/curation_concerns/workflow/sipity_actions_generator.rb +49 -0
- data/app/services/curation_concerns/workflow/state_machine_generator.rb +102 -0
- data/app/services/curation_concerns/workflow/status_list_service.rb +52 -0
- data/app/services/curation_concerns/workflow/workflow_action_service.rb +56 -0
- data/app/services/curation_concerns/workflow/workflow_by_model_name_strategy.rb +14 -0
- data/app/services/curation_concerns/workflow/workflow_factory.rb +64 -0
- data/app/services/curation_concerns/workflow/workflow_importer.rb +103 -0
- data/app/services/curation_concerns/workflow/workflow_permissions_generator.rb +49 -0
- data/app/services/curation_concerns/workflow/workflow_schema.rb +56 -0
- data/app/services/rights_service.rb +1 -1
- data/app/services/sipity.rb +2 -0
- data/app/sources/curation_concerns/resource_statistics_source.rb +101 -0
- data/app/values/curation_concerns/chart_data.rb +61 -0
- data/app/views/curation_concerns/admin/_admin_menu.html.erb +5 -0
- data/app/views/curation_concerns/admin/_resource_stats.html.erb +43 -0
- data/app/views/curation_concerns/admin/_sidebar.html.erb +3 -0
- data/app/views/curation_concerns/admin/_total_embargo_visibility.html.erb +21 -0
- data/app/views/curation_concerns/admin/_total_objects.html.erb +1 -0
- data/app/views/curation_concerns/admin/_total_objects_charts.html.erb +12 -0
- data/app/views/curation_concerns/admin/index.html.erb +11 -0
- data/app/views/curation_concerns/admin/widgets/_pie.html.erb +1 -0
- data/app/views/curation_concerns/admin/workflow.html.erb +31 -0
- data/app/views/curation_concerns/admin/workflow_roles/index.html.erb +45 -0
- data/app/views/curation_concerns/base/_form_rights.html.erb +1 -1
- data/app/views/curation_concerns/base/_workflow_actions.html.erb +39 -0
- data/app/views/curation_concerns/base/show.html.erb +2 -0
- data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +0 -1
- data/app/views/layouts/_head_tag_content.html.erb +13 -0
- data/app/views/layouts/admin.html.erb +10 -0
- data/app/views/shared/_my_actions.html.erb +4 -1
- data/config/initializers/precompile_assets.rb +1 -0
- data/config/locales/curation_concerns.en.yml +97 -56
- data/config/routes.rb +7 -0
- data/curation_concerns.gemspec +9 -3
- data/db/migrate/20160919151348_create_sipity.rb +163 -0
- data/db/migrate/20161012182404_create_sipity_workflow_methods.rb +10 -0
- data/lib/curation_concerns/configuration.rb +68 -0
- data/lib/curation_concerns/engine.rb +9 -1
- data/lib/curation_concerns/rails/routes.rb +1 -0
- data/lib/curation_concerns/version.rb +1 -1
- data/lib/curation_concerns.rb +1 -1
- data/lib/generators/curation_concerns/admin_dashboard_generator.rb +15 -0
- data/lib/generators/curation_concerns/install_generator.rb +7 -0
- data/lib/generators/curation_concerns/sample_data_generator.rb +12 -0
- data/lib/generators/curation_concerns/templates/app/controllers/curation_concerns/admin_controller.rb +61 -0
- data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -3
- data/lib/generators/curation_concerns/templates/config/curation_concerns.rb +39 -0
- data/lib/generators/curation_concerns/templates/db/seeds.rb +94 -0
- data/lib/generators/curation_concerns/templates/spec/models/collection_spec.rb +1 -1
- data/lib/generators/curation_concerns/templates/spec/models/file_set_spec.rb +1 -1
- data/lib/generators/curation_concerns/templates/workflow.json.erb +19 -0
- data/lib/generators/curation_concerns/work/USAGE +1 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +1 -1
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +1 -1
- data/lib/generators/curation_concerns/work/templates/feature_spec.rb.erb +1 -1
- data/lib/generators/curation_concerns/work/templates/form_spec.rb.erb +1 -1
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +1 -1
- data/spec/abilities/admin_ability_spec.rb +15 -0
- data/spec/actors/curation_concerns/file_set_actor_spec.rb +24 -0
- data/spec/actors/curation_concerns/grant_edit_to_depositor_actor_spec.rb +32 -0
- data/spec/actors/curation_concerns/initialize_workflow_actor_spec.rb +33 -0
- data/spec/actors/curation_concerns/interpret_visibility_actor_spec.rb +1 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +10 -5
- data/spec/controllers/curation_concerns/acts_as_admin_controller_spec.rb +22 -0
- data/spec/controllers/curation_concerns/admin/workflow_roles_controller_spec.rb +26 -0
- data/spec/controllers/curation_concerns/admin_controller_spec.rb +64 -0
- data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +11 -3
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +4 -4
- data/spec/controllers/curation_concerns/workflow_actions_controller_spec.rb +36 -0
- data/spec/conversions/power_converters/polymorphic_type_spec.rb +22 -0
- data/spec/conversions/power_converters/sipity_action_name_spec.rb +32 -0
- data/spec/conversions/power_converters/sipity_action_spec.rb +43 -0
- data/spec/conversions/power_converters/sipity_agent_spec.rb +20 -0
- data/spec/conversions/power_converters/sipity_entity_spec.rb +46 -0
- data/spec/conversions/power_converters/sipity_role_spec.rb +33 -0
- data/spec/conversions/power_converters/sipity_workflow_id_spec.rb +28 -0
- data/spec/conversions/power_converters/sipity_workflow_state_spec.rb +22 -0
- data/spec/factories/generic_works.rb +19 -6
- data/spec/factories/sipity_entities.rb +7 -0
- data/spec/factories/workflow_actions.rb +6 -0
- data/spec/factories/workflow_states.rb +6 -0
- data/spec/factories/workflows.rb +5 -0
- data/spec/features/admin_spec.rb +14 -0
- data/spec/features/create_child_work_spec.rb +1 -1
- data/spec/features/create_work_spec.rb +1 -1
- data/spec/features/embargo_spec.rb +1 -1
- data/spec/features/lease_spec.rb +1 -1
- data/spec/features/work_generator_spec.rb +2 -2
- data/spec/features/workflow_roles_spec.rb +48 -0
- data/spec/forms/curation_concerns/forms/workflow_action_form_spec.rb +111 -0
- data/spec/forms/curation_concerns/forms/workflow_responsibility_form_spec.rb +33 -0
- data/spec/helpers/curation_concerns/charts_helper_spec.rb +62 -0
- data/spec/helpers/url_helper_spec.rb +11 -11
- data/spec/indexers/work_indexer_spec.rb +13 -1
- data/spec/javascripts/charts_spec.coffee +10 -0
- data/spec/javascripts/fixtures/chart_example.html +1 -0
- data/spec/jobs/import_export_job_spec.rb +28 -0
- data/spec/models/curation_concerns/group_spec.rb +15 -0
- data/spec/models/file_set_spec.rb +6 -2
- data/spec/models/generic_work_spec.rb +12 -0
- data/spec/models/sipity/agent_spec.rb +9 -0
- data/spec/models/sipity/comment_spec.rb +16 -0
- data/spec/models/sipity/entity_spec.rb +27 -0
- data/spec/models/sipity/entity_specific_responsibility_spec.rb +8 -0
- data/spec/models/sipity/notifiable_context_spec.rb +8 -0
- data/spec/models/sipity/notification_recipient_spec.rb +10 -0
- data/spec/models/sipity/notification_spec.rb +15 -0
- data/spec/models/sipity/role_spec.rb +30 -0
- data/spec/models/sipity/workflow_action_spec.rb +10 -0
- data/spec/models/sipity/workflow_responsibility_spec.rb +7 -0
- data/spec/models/sipity/workflow_role_spec.rb +7 -0
- data/spec/models/sipity/workflow_spec.rb +15 -0
- data/spec/models/sipity/workflow_state_action_permission_spec.rb +7 -0
- data/spec/models/sipity/workflow_state_action_spec.rb +7 -0
- data/spec/models/sipity/workflow_state_spec.rb +7 -0
- data/spec/models/user_spec.rb +12 -1
- data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +12 -1
- data/spec/presenters/curation_concerns/workflow_presenter_spec.rb +39 -0
- data/spec/routing/route_spec.rb +13 -0
- data/spec/services/curation_concerns/admin_set_service_spec.rb +13 -0
- data/spec/services/curation_concerns/qa_select_service_spec.rb +75 -0
- data/spec/services/curation_concerns/workflow/action_taken_service_spec.rb +76 -0
- data/spec/services/curation_concerns/workflow/activate_object_spec.rb +20 -0
- data/spec/services/curation_concerns/workflow/deactivate_object_spec.rb +20 -0
- data/spec/services/curation_concerns/workflow/method_generator_spec.rb +43 -0
- data/spec/services/curation_concerns/workflow/notification_configuration_parameter_spec.rb +25 -0
- data/spec/services/curation_concerns/workflow/notification_generator_spec.rb +27 -0
- data/spec/services/curation_concerns/workflow/notification_service_spec.rb +81 -0
- data/spec/services/curation_concerns/workflow/permission_generator_spec.rb +52 -0
- data/spec/services/curation_concerns/workflow/permission_query_spec.rb +179 -0
- data/spec/services/curation_concerns/workflow/remove_depositor_permissions_spec.rb +21 -0
- data/spec/services/curation_concerns/workflow/sipity_actions_generator_spec.rb +30 -0
- data/spec/services/curation_concerns/workflow/state_machine_generator_spec.rb +46 -0
- data/spec/services/curation_concerns/workflow/status_list_service_spec.rb +46 -0
- data/spec/services/curation_concerns/workflow/workflow_importer_spec.rb +50 -0
- data/spec/services/curation_concerns/workflow/workflow_permissions_generator_spec.rb +37 -0
- data/spec/services/curation_concerns/workflow/workflow_schema_spec.rb +85 -0
- data/spec/sources/curation_concerns/resource_statistics_source_spec.rb +137 -0
- data/spec/spec_helper.rb +8 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +11 -0
- data/spec/views/curation_concerns/admin/_admin_menu.html.erb_spec.rb +23 -0
- data/spec/views/curation_concerns/admin/_resource_stats.html.erb_spec.rb +33 -0
- data/spec/views/curation_concerns/admin/_total_objects_charts.html.erb_spec.rb +28 -0
- data/spec/views/curation_concerns/admin/index.html.erb_spec.rb +26 -0
- data/spec/views/curation_concerns/admin/widgets/_pie.html.erb_spec.rb +17 -0
- data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +1 -1
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +33 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +1 -1
- data/spec/views/shared/_my_actions.html.erb_spec.rb +1 -0
- data/tasks/workflow.rake +8 -0
- 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="{"drilldown":{"series":[]},"series":[{"name":"mine","y":1},{"name":"yours","y":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,
|
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
|
|