hyrax 3.0.0.pre.beta1 → 3.0.0.pre.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +157 -68
- data/.travis.yml +4 -1
- data/Gemfile +1 -0
- data/README.md +3 -3
- data/app/actors/hyrax/actors/collections_membership_actor.rb +5 -55
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +6 -8
- data/app/actors/hyrax/actors/environment.rb +15 -0
- data/app/actors/hyrax/actors/interpret_visibility_actor.rb +22 -37
- data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +1 -1
- data/app/assets/stylesheets/hyrax/_collections.scss +5 -3
- data/app/assets/stylesheets/hyrax/dashboard.scss +3 -3
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +21 -2
- data/app/controllers/hyrax/homepage_controller.rb +1 -1
- data/app/forms/hyrax/forms/work_form.rb +1 -1
- data/app/helpers/hyrax/collections_helper.rb +13 -0
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +3 -3
- data/app/indexers/hyrax/admin_set_indexer.rb +1 -1
- data/app/indexers/hyrax/basic_metadata_indexer.rb +1 -1
- data/app/indexers/hyrax/collection_indexer.rb +3 -3
- data/app/indexers/hyrax/deep_indexing_service.rb +12 -12
- data/app/indexers/hyrax/file_set_indexer.rb +1 -1
- data/app/indexers/hyrax/indexes_workflow.rb +4 -4
- data/app/indexers/hyrax/work_indexer.rb +1 -1
- data/app/models/concerns/hyrax/basic_metadata.rb +2 -0
- data/app/models/concerns/hyrax/collection_behavior.rb +3 -3
- data/app/models/concerns/hyrax/file_set/querying.rb +1 -1
- data/app/models/concerns/hyrax/human_readable_type.rb +2 -2
- data/app/models/concerns/hyrax/solr_document/characterization.rb +23 -23
- data/app/models/concerns/hyrax/solr_document/metadata.rb +3 -2
- data/app/models/concerns/hyrax/solr_document_behavior.rb +3 -3
- data/app/models/concerns/hyrax/user.rb +10 -2
- data/app/presenters/hyrax/work_show_presenter.rb +2 -2
- data/app/renderers/hyrax/renderers/faceted_attribute_renderer.rb +1 -1
- data/app/search_builders/hyrax/collection_search_builder.rb +1 -1
- data/app/search_builders/hyrax/deposit_search_builder.rb +1 -1
- data/app/search_builders/hyrax/embargo_search_builder.rb +1 -1
- data/app/search_builders/hyrax/lease_search_builder.rb +1 -1
- data/app/services/hyrax/default_middleware_stack.rb +0 -4
- data/app/services/hyrax/statistics/file_sets/by_format.rb +1 -1
- data/app/services/hyrax/statistics/works/by_resource_type.rb +1 -1
- data/app/services/hyrax/visibility_intention.rb +78 -0
- data/app/views/catalog/_index_list_default.html.erb +3 -3
- data/app/views/catalog/_thumbnail_list_collection.html.erb +3 -2
- data/app/views/hyrax/base/_attribute_rows.html.erb +1 -0
- data/app/views/hyrax/base/_form_files.html.erb +2 -2
- data/app/views/hyrax/base/_form_visibility_component.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +6 -6
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_edits/_check_all.html.erb +1 -1
- data/app/views/hyrax/batch_edits/_delete_selected.html.erb +1 -1
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +4 -4
- data/app/views/records/show_fields/_based_near.html.erb +1 -1
- data/app/views/records/show_fields/_creator.html.erb +1 -1
- data/app/views/records/show_fields/_keyword.html.erb +1 -1
- data/app/views/records/show_fields/_language.html.erb +1 -1
- data/app/views/records/show_fields/_publisher.html.erb +1 -1
- data/app/views/records/show_fields/_resource_type.html.erb +1 -1
- data/app/views/records/show_fields/_subject.html.erb +1 -1
- data/config/initializers/samvera-nesting_indexer_initializer.rb +3 -3
- data/config/locales/hyrax.de.yml +35 -22
- data/config/locales/hyrax.en.yml +22 -2
- data/config/locales/hyrax.es.yml +21 -1
- data/config/locales/hyrax.fr.yml +21 -1
- data/config/locales/hyrax.it.yml +21 -1
- data/config/locales/hyrax.pt-BR.yml +21 -1
- data/config/locales/hyrax.zh.yml +21 -1
- data/hyrax.gemspec +7 -9
- data/lib/generators/hyrax/templates/catalog_controller.rb +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +10 -10
- data/lib/generators/hyrax/work/templates/locale.pt-BR.yml.erb +1 -1
- data/lib/hyrax/configuration.rb +18 -0
- data/lib/hyrax/engine.rb +8 -0
- data/lib/hyrax/transactions/container.rb +6 -0
- data/lib/hyrax/transactions/destroy_work.rb +21 -0
- data/lib/hyrax/transactions/steps/destroy_work.rb +24 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings.rb +45 -0
- data/lib/wings/active_fedora_converter.rb +56 -0
- data/lib/wings/model_transformer.rb +158 -0
- data/lib/wings/resource_factory.rb +8 -0
- data/lib/wings/valkyrie/metadata_adapter.rb +29 -0
- data/lib/wings/valkyrie/persister.rb +50 -0
- data/lib/wings/valkyrie/query_service.rb +43 -0
- data/lib/wings/valkyrie/resource_factory.rb +45 -0
- data/lib/wings/valkyrizable.rb +24 -0
- data/lib/wings/value_mapper.rb +59 -0
- data/spec/abilities/collection_ability_spec.rb +5 -5
- data/spec/abilities/permission_template_ability_spec.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +6 -175
- data/spec/actors/hyrax/actors/create_with_remote_files_ordered_members_actor_spec.rb +30 -22
- data/spec/actors/hyrax/actors/interpret_visibility_actor_spec.rb +2 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/collections_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb +16 -13
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +10 -1
- data/spec/controllers/hyrax/homepage_controller_spec.rb +3 -3
- data/spec/controllers/hyrax/my/shares_controller_spec.rb +1 -1
- data/spec/features/actor_stack_spec.rb +48 -0
- data/spec/features/catalog_search_spec.rb +2 -2
- data/spec/features/collection_multi_membership_spec.rb +2 -2
- data/spec/features/collection_spec.rb +7 -7
- data/spec/features/collection_type_spec.rb +2 -2
- data/spec/features/dashboard/collection_spec.rb +18 -18
- data/spec/features/delete_work_spec.rb +1 -1
- data/spec/features/search_spec.rb +2 -2
- data/spec/features/work_show_spec.rb +5 -2
- data/spec/forms/hyrax/forms/batch_upload_form_spec.rb +1 -0
- data/spec/forms/hyrax/forms/collection_form_spec.rb +5 -5
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +1 -1
- data/spec/forms/hyrax/forms/work_form_spec.rb +2 -0
- data/spec/helpers/blacklight_helper_spec.rb +3 -1
- data/spec/helpers/hyrax/collections_helper_spec.rb +42 -0
- data/spec/helpers/hyrax/dashboard_helper_behavior_spec.rb +4 -4
- data/spec/helpers/hyrax_helper_spec.rb +8 -4
- data/spec/hyrax/transactions/destroy_work_spec.rb +35 -0
- data/spec/hyrax/transactions/steps/destroy_work_spec.rb +33 -0
- data/spec/indexers/hyrax/collection_indexer_spec.rb +1 -1
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/lib/hyrax/resource_sync/change_list_writer_spec.rb +35 -21
- data/spec/lib/hyrax/resource_sync/resource_list_writer_spec.rb +1 -1
- data/spec/models/collection_spec.rb +18 -18
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +2 -2
- data/spec/models/file_set_spec.rb +2 -2
- data/spec/models/hyrax/collection_type_spec.rb +2 -2
- data/spec/models/user_spec.rb +26 -1
- data/spec/presenters/hyrax/collection_presenter_spec.rb +11 -11
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +11 -0
- data/spec/search_builders/hyrax/collection_member_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/collection_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/work_relation_spec.rb +1 -1
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +2 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +2 -2
- data/spec/services/hyrax/collections/migration_service_spec.rb +27 -27
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/nested_collection_query_service_spec.rb +38 -38
- data/spec/services/hyrax/curation_concern_spec.rb +1 -1
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -2
- data/spec/services/hyrax/statistics/depositors/summary_spec.rb +1 -1
- data/spec/services/hyrax/statistics/works/by_resource_type_spec.rb +11 -4
- data/spec/services/hyrax/visibility_intention_spec.rb +144 -0
- data/spec/services/hyrax/workflow/changes_required_notification_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- data/spec/support/selectors.rb +10 -1
- data/spec/test_app_templates/Gemfile.extra +2 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +6 -0
- data/spec/views/catalog/_index_list_default.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb +38 -5
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +9 -9
- data/spec/views/hyrax/base/show.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/wings/active_fedora_converter_spec.rb +31 -0
- data/spec/wings/model_transformer_spec.rb +288 -0
- data/spec/wings/valkyrie/metadata_adapter_spec.rb +10 -0
- data/spec/wings/valkyrie/persister_spec.rb +71 -0
- data/spec/wings/valkyrie/query_service_spec.rb +81 -0
- data/spec/wings/valkyrie/resource_factory_spec.rb +32 -0
- data/spec/wings/value_mapper_spec.rb +60 -0
- data/spec/wings_spec.rb +8 -0
- data/template.rb +3 -1
- metadata +86 -36
|
@@ -2,9 +2,9 @@ RSpec.describe Hyrax::Collections::CollectionMemberService, clean_repo: true do
|
|
|
2
2
|
let(:blacklight_config) { CatalogController.blacklight_config }
|
|
3
3
|
let(:repository) { Blacklight::Solr::Repository.new(blacklight_config) }
|
|
4
4
|
let(:current_ability) { instance_double(Ability, admin?: true) }
|
|
5
|
-
let!(:nestable_collection) { create(:
|
|
5
|
+
let!(:nestable_collection) { create(:public_collection_lw, collection_type_settings: [:nestable]) }
|
|
6
6
|
let(:scope) { double('Scope', current_ability: current_ability, repository: repository, blacklight_config: blacklight_config, collection: nestable_collection) }
|
|
7
|
-
let!(:subcollection) { create(:
|
|
7
|
+
let!(:subcollection) { create(:public_collection_lw, member_of_collections: [nestable_collection], collection_type_settings: [:nestable]) }
|
|
8
8
|
let(:builder) { described_class.new(scope: scope, collection: nestable_collection, params: { "id" => nestable_collection.id.to_s }) }
|
|
9
9
|
|
|
10
10
|
let!(:work1) { create(:generic_work, member_of_collections: [nestable_collection]) }
|
|
@@ -14,11 +14,11 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
14
14
|
|
|
15
15
|
describe ".migrate_all_collections" do
|
|
16
16
|
context 'when legacy collections are found (e.g. collections created before Hyrax 2.1.0)' do
|
|
17
|
-
let!(:col_none) { build(:typeless_collection,
|
|
18
|
-
let!(:col_vu) { build(:typeless_collection,
|
|
19
|
-
let!(:col_vg) { build(:typeless_collection,
|
|
20
|
-
let!(:col_mu) { build(:typeless_collection,
|
|
21
|
-
let!(:col_mg) { build(:typeless_collection,
|
|
17
|
+
let!(:col_none) { build(:typeless_collection, user: user, edit_users: [user.user_key], do_save: true) }
|
|
18
|
+
let!(:col_vu) { build(:typeless_collection, user: user, edit_users: [user.user_key], read_users: [reader1.user_key, reader2.user_key], do_save: true) }
|
|
19
|
+
let!(:col_vg) { build(:typeless_collection, user: user, edit_users: [user.user_key], read_groups: ['read_group_1', 'read_group_2'], do_save: true) }
|
|
20
|
+
let!(:col_mu) { build(:typeless_collection, user: user, edit_users: [user.user_key, editor1.user_key, editor2.user_key], do_save: true) }
|
|
21
|
+
let!(:col_mg) { build(:typeless_collection, user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'], do_save: true) }
|
|
22
22
|
|
|
23
23
|
it 'sets gid and adds permissions' do # rubocop:disable RSpec/ExampleLength
|
|
24
24
|
Collection.all.each do |col|
|
|
@@ -158,11 +158,11 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
158
158
|
let!(:col_mg) { build(:typeless_collection, id: 'col_mg', user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'], do_save: true) }
|
|
159
159
|
|
|
160
160
|
context "and collection wasn't migrated at all" do
|
|
161
|
-
let!(:col_none) { build(:
|
|
162
|
-
let!(:col_vu) { build(:
|
|
163
|
-
let!(:col_vg) { build(:
|
|
164
|
-
let!(:col_mu) { build(:
|
|
165
|
-
let!(:col_mg) { build(:
|
|
161
|
+
let!(:col_none) { build(:typeless_collection_lw, user: user, edit_users: [user.user_key], read_users: [], do_save: true) }
|
|
162
|
+
let!(:col_vu) { build(:typeless_collection_lw, user: user, edit_users: [user.user_key], read_users: [reader1.user_key, reader2.user_key], do_save: true) }
|
|
163
|
+
let!(:col_vg) { build(:typeless_collection_lw, user: user, edit_users: [user.user_key], read_groups: ['read_group_1', 'read_group_2'], do_save: true) }
|
|
164
|
+
let!(:col_mu) { build(:typeless_collection_lw, user: user, edit_users: [user.user_key, editor1.user_key, editor2.user_key], do_save: true) }
|
|
165
|
+
let!(:col_mg) { build(:typeless_collection_lw, user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'], do_save: true) }
|
|
166
166
|
|
|
167
167
|
it 'sets gid and adds permissions' do # rubocop:disable RSpec/ExampleLength
|
|
168
168
|
Collection.all.each do |col|
|
|
@@ -185,11 +185,11 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
context "and collection type gid is set but permission template doesn't exist" do
|
|
188
|
-
let!(:col_none) {
|
|
189
|
-
let!(:col_vu) {
|
|
190
|
-
let!(:col_vg) {
|
|
191
|
-
let!(:col_mu) {
|
|
192
|
-
let!(:col_mg) {
|
|
188
|
+
let!(:col_none) { build(:user_collection_lw, id: 'col_none', user: user, edit_users: [user.user_key], collection_type_gid: default_gid) }
|
|
189
|
+
let!(:col_vu) { build(:user_collection_lw, id: 'col_vu', user: user, edit_users: [user.user_key], read_users: [reader1.user_key, reader2.user_key], collection_type_gid: default_gid) }
|
|
190
|
+
let!(:col_vg) { build(:user_collection_lw, id: 'col_vg', user: user, edit_users: [user.user_key], read_groups: ['read_group_1', 'read_group_2'], collection_type_gid: default_gid) }
|
|
191
|
+
let!(:col_mu) { build(:user_collection_lw, id: 'col_mu', user: user, edit_users: [user.user_key, editor1.user_key, editor2.user_key], collection_type_gid: default_gid) }
|
|
192
|
+
let!(:col_mg) { build(:user_collection_lw, id: 'col_mg', user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'], collection_type_gid: default_gid) }
|
|
193
193
|
|
|
194
194
|
it 'sets gid and adds permissions' do # rubocop:disable RSpec/ExampleLength
|
|
195
195
|
Collection.all.each do |col|
|
|
@@ -212,21 +212,21 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
212
212
|
end
|
|
213
213
|
|
|
214
214
|
context "and collection type gid isn't set but permission template exists with access set" do
|
|
215
|
-
let!(:col_none) { build(:typeless_collection,
|
|
215
|
+
let!(:col_none) { build(:typeless_collection, user: user, edit_users: [user.user_key], do_save: true, with_permission_template: true) }
|
|
216
216
|
let!(:col_vu) do
|
|
217
|
-
build(:typeless_collection,
|
|
217
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], read_users: [reader1.user_key, reader2.user_key],
|
|
218
218
|
do_save: true, with_permission_template: true)
|
|
219
219
|
end
|
|
220
220
|
let!(:col_vg) do
|
|
221
|
-
build(:typeless_collection,
|
|
221
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], read_groups: ['read_group_1', 'read_group_2'],
|
|
222
222
|
do_save: true, with_permission_template: true)
|
|
223
223
|
end
|
|
224
224
|
let!(:col_mu) do
|
|
225
|
-
build(:typeless_collection,
|
|
225
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key, editor1.user_key, editor2.user_key],
|
|
226
226
|
do_save: true, with_permission_template: true)
|
|
227
227
|
end
|
|
228
228
|
let!(:col_mg) do
|
|
229
|
-
build(:typeless_collection,
|
|
229
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'],
|
|
230
230
|
do_save: true, with_permission_template: true)
|
|
231
231
|
end
|
|
232
232
|
|
|
@@ -276,21 +276,21 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
276
276
|
end
|
|
277
277
|
|
|
278
278
|
context "and collection type gid isn't set and permission template exists with access not set" do
|
|
279
|
-
let!(:col_none) { build(:typeless_collection,
|
|
279
|
+
let!(:col_none) { build(:typeless_collection, user: user, edit_users: [user.user_key], do_save: true, with_permission_template: true) }
|
|
280
280
|
let!(:col_vu) do
|
|
281
|
-
build(:typeless_collection,
|
|
281
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], read_users: [reader1.user_key, reader2.user_key],
|
|
282
282
|
do_save: true, with_permission_template: true)
|
|
283
283
|
end
|
|
284
284
|
let!(:col_vg) do
|
|
285
|
-
build(:typeless_collection,
|
|
285
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], read_groups: ['read_group_1', 'read_group_2'],
|
|
286
286
|
do_save: true, with_permission_template: true)
|
|
287
287
|
end
|
|
288
288
|
let!(:col_mu) do
|
|
289
|
-
build(:typeless_collection,
|
|
289
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key, editor1.user_key, editor2.user_key],
|
|
290
290
|
do_save: true, with_permission_template: true)
|
|
291
291
|
end
|
|
292
292
|
let!(:col_mg) do
|
|
293
|
-
build(:typeless_collection,
|
|
293
|
+
build(:typeless_collection, user: user, edit_users: [user.user_key], edit_groups: ['edit_group_1', 'edit_group_2'],
|
|
294
294
|
do_save: true, with_permission_template: true)
|
|
295
295
|
end
|
|
296
296
|
|
|
@@ -322,8 +322,8 @@ RSpec.describe Hyrax::Collections::MigrationService, clean_repo: true do
|
|
|
322
322
|
|
|
323
323
|
context 'when newer collections are found (e.g. collections created at or after Hyrax 2.1.0)' do
|
|
324
324
|
let!(:collection) do
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
build(:collection_lw, id: 'col_newer', user: user, with_permission_template: true, collection_type_settings: [:discoverable],
|
|
326
|
+
edit_users: [user.user_key])
|
|
327
327
|
end
|
|
328
328
|
let!(:permission_template) { collection.permission_template }
|
|
329
329
|
let!(:collection_type_gid) { collection.collection_type_gid }
|
|
@@ -153,57 +153,57 @@ RSpec.describe Hyrax::Collections::NestedCollectionQueryService, clean_repo: tru
|
|
|
153
153
|
|
|
154
154
|
# using create option here because permission template is required for testing :deposit access
|
|
155
155
|
let(:coll_a) do
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
build(:public_collection_lw,
|
|
157
|
+
id: 'Collection_A',
|
|
158
|
+
collection_type_gid: collection_type.gid,
|
|
159
|
+
user: user,
|
|
160
|
+
with_permission_template: true)
|
|
161
161
|
end
|
|
162
162
|
let(:coll_b) do
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
build(:public_collection_lw,
|
|
164
|
+
id: 'Collection_B',
|
|
165
|
+
collection_type_gid: collection_type.gid,
|
|
166
|
+
user: user,
|
|
167
|
+
with_permission_template: true,
|
|
168
|
+
member_of_collections: [coll_a])
|
|
169
169
|
end
|
|
170
170
|
let(:coll_c) do
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
build(:public_collection_lw,
|
|
172
|
+
id: 'Collection_C',
|
|
173
|
+
collection_type_gid: collection_type.gid,
|
|
174
|
+
user: user,
|
|
175
|
+
with_permission_template: true,
|
|
176
|
+
member_of_collections: [coll_b])
|
|
177
177
|
end
|
|
178
178
|
let(:coll_d) do
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
build(:public_collection_lw,
|
|
180
|
+
id: 'Collection_D',
|
|
181
|
+
collection_type_gid: collection_type.gid,
|
|
182
|
+
user: user,
|
|
183
|
+
with_permission_template: true,
|
|
184
|
+
member_of_collections: [coll_c])
|
|
185
185
|
end
|
|
186
186
|
let(:coll_e) do
|
|
187
|
-
create(:
|
|
187
|
+
create(:public_collection_lw,
|
|
188
188
|
id: 'Collection_E',
|
|
189
189
|
collection_type_gid: collection_type.gid,
|
|
190
190
|
user: user,
|
|
191
|
-
|
|
191
|
+
with_permission_template: true,
|
|
192
192
|
member_of_collections: [coll_d])
|
|
193
193
|
end
|
|
194
194
|
let(:another) do
|
|
195
|
-
create(:
|
|
195
|
+
create(:public_collection_lw,
|
|
196
196
|
id: 'Another_One',
|
|
197
197
|
collection_type_gid: collection_type.gid,
|
|
198
198
|
user: user,
|
|
199
|
-
|
|
199
|
+
with_permission_template: true)
|
|
200
200
|
end
|
|
201
201
|
let(:wrong) do
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
build(:public_collection_lw,
|
|
203
|
+
id: 'Wrong_Type',
|
|
204
|
+
collection_type_gid: another_collection_type.gid,
|
|
205
|
+
user: user,
|
|
206
|
+
with_permission_template: true)
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
before do
|
|
@@ -245,18 +245,18 @@ RSpec.describe Hyrax::Collections::NestedCollectionQueryService, clean_repo: tru
|
|
|
245
245
|
describe 'and are of the same collection type', with_nested_reindexing: true do
|
|
246
246
|
# using create option here because permission template is required for testing :deposit access
|
|
247
247
|
let!(:parent) do
|
|
248
|
-
create(:
|
|
248
|
+
create(:public_collection_lw,
|
|
249
249
|
id: 'Parent_Collecton',
|
|
250
250
|
collection_type_gid: collection_type.gid,
|
|
251
251
|
user: user,
|
|
252
|
-
|
|
252
|
+
with_permission_template: true)
|
|
253
253
|
end
|
|
254
254
|
let!(:child) do
|
|
255
|
-
create(:
|
|
255
|
+
create(:public_collection_lw,
|
|
256
256
|
id: 'Child_Collection',
|
|
257
257
|
collection_type_gid: collection_type.gid,
|
|
258
258
|
user: user,
|
|
259
|
-
|
|
259
|
+
with_permission_template: true)
|
|
260
260
|
end
|
|
261
261
|
|
|
262
262
|
it { is_expected.to eq(true) }
|
|
@@ -325,8 +325,8 @@ RSpec.describe Hyrax::Collections::NestedCollectionQueryService, clean_repo: tru
|
|
|
325
325
|
|
|
326
326
|
describe 'nesting attributes object', with_nested_reindexing: true do
|
|
327
327
|
let(:user) { create(:user) }
|
|
328
|
-
let!(:parent) {
|
|
329
|
-
let!(:child) { create(:
|
|
328
|
+
let!(:parent) { build(:collection_lw, id: 'Parent_Coll', collection_type_gid: collection_type.gid, user: user) }
|
|
329
|
+
let!(:child) { create(:user_collection_lw, id: 'Child_Coll', collection_type_gid: collection_type.gid, user: user) }
|
|
330
330
|
let(:nesting_attributes) { Hyrax::Collections::NestedCollectionQueryService::NestingAttributes.new(id: child.id, scope: scope) }
|
|
331
331
|
|
|
332
332
|
before do
|
|
@@ -5,7 +5,7 @@ RSpec.describe Hyrax::CurationConcern do
|
|
|
5
5
|
describe ".actor" do
|
|
6
6
|
subject { described_class.actor }
|
|
7
7
|
|
|
8
|
-
it { is_expected.to be_kind_of Hyrax::Actors::
|
|
8
|
+
it { is_expected.to be_kind_of Hyrax::Actors::AbstractActor }
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
describe ".actor_factory" do
|
|
@@ -7,7 +7,6 @@ RSpec.describe Hyrax::DefaultMiddlewareStack do
|
|
|
7
7
|
|
|
8
8
|
it "has the correct stack frames" do
|
|
9
9
|
expect(subject.middlewares).to eq [
|
|
10
|
-
Hyrax::Actors::TransactionalRequest,
|
|
11
10
|
Hyrax::Actors::OptimisticLockValidator,
|
|
12
11
|
Hyrax::Actors::CreateWithRemoteFilesActor,
|
|
13
12
|
Hyrax::Actors::CreateWithFilesActor,
|
|
@@ -30,7 +29,7 @@ RSpec.describe Hyrax::DefaultMiddlewareStack do
|
|
|
30
29
|
|
|
31
30
|
describe 'Hyrax::CurationConcern.actor' do
|
|
32
31
|
it "calls the Hyrax::ActorFactory" do
|
|
33
|
-
expect(Hyrax::CurationConcern.actor).to be_instance_of Hyrax::Actors::
|
|
32
|
+
expect(Hyrax::CurationConcern.actor).to be_instance_of Hyrax::Actors::OptimisticLockValidator
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
end
|
|
@@ -8,7 +8,7 @@ RSpec.describe Hyrax::Statistics::Depositors::Summary, :clean_repo do
|
|
|
8
8
|
let(:end_date) { nil }
|
|
9
9
|
let!(:work1) { create(:work, user: user1) }
|
|
10
10
|
let!(:work2) { create(:work, user: user2) }
|
|
11
|
-
let!(:collection1) { create(:
|
|
11
|
+
let!(:collection1) { create(:public_collection_lw, user: user1) }
|
|
12
12
|
let(:service) { described_class.new(start_date, end_date) }
|
|
13
13
|
|
|
14
14
|
before do
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
RSpec.describe Hyrax::Statistics::Works::ByResourceType do
|
|
2
2
|
let(:service) { described_class.new }
|
|
3
|
+
let(:user) { create(:user) }
|
|
3
4
|
|
|
4
5
|
describe "#query", :clean_repo do
|
|
5
6
|
before do
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
create(:generic_work
|
|
9
|
-
|
|
7
|
+
# Creating factories here led to failures found within
|
|
8
|
+
# https://travis-ci.org/samvera/hyrax/jobs/454752377
|
|
9
|
+
# One should be able to invoke create(:generic_work)...
|
|
10
|
+
# ...however, there are difficulties here which relate to the "terms"
|
|
11
|
+
# requestHandler
|
|
12
|
+
# @see https://github.com/samvera/hyrax/issues/3491
|
|
13
|
+
GenericWork.create(title: ['test'], resource_type: ['Conference Proceeding']).save!
|
|
14
|
+
GenericWork.create(title: ['test'], resource_type: ['Conference Proceeding']).save!
|
|
15
|
+
GenericWork.create(title: ['test'], resource_type: ['Image']).save!
|
|
16
|
+
GenericWork.create(title: ['test'], resource_type: ['Journal']).save!
|
|
10
17
|
end
|
|
11
18
|
|
|
12
19
|
subject { service.query }
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe Hyrax::VisibilityIntention do
|
|
4
|
+
subject(:intention) { described_class.new(attributes) }
|
|
5
|
+
let(:attributes) { {} }
|
|
6
|
+
|
|
7
|
+
describe '#embargo_params' do
|
|
8
|
+
it 'is empty when no embargo is requested' do
|
|
9
|
+
expect(intention.embargo_params).to be_empty
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
context 'when an embargo is requested with no release date' do
|
|
13
|
+
let(:attributes) { { visibility: described_class::EMBARGO_REQUEST } }
|
|
14
|
+
|
|
15
|
+
it 'raises an error' do
|
|
16
|
+
expect { intention.embargo_params }.to raise_error ArgumentError
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
context 'when an embargo is requested with valid release date' do
|
|
21
|
+
let(:attributes) do
|
|
22
|
+
{ visibility: described_class::EMBARGO_REQUEST, release_date: date }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
let(:date) { Time.zone.today }
|
|
26
|
+
|
|
27
|
+
it 'builds private -> public embargo' do
|
|
28
|
+
expect(intention.embargo_params).to eq [date, described_class::PRIVATE, described_class::PUBLIC]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context 'when an embargo is requested with specific visibilities' do
|
|
33
|
+
let(:attributes) do
|
|
34
|
+
{ visibility: described_class::EMBARGO_REQUEST,
|
|
35
|
+
release_date: date,
|
|
36
|
+
after: after,
|
|
37
|
+
during: during }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
let(:after) { 'custom_after_embargo_visibility' }
|
|
41
|
+
let(:date) { Time.zone.today }
|
|
42
|
+
let(:during) { 'custom_during_embargo_visibility' }
|
|
43
|
+
|
|
44
|
+
it 'builds private -> public embargo' do
|
|
45
|
+
expect(intention.embargo_params).to eq [date, during, after]
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe '#lease_params' do
|
|
51
|
+
it 'is empty when no lease is requested' do
|
|
52
|
+
expect(intention.lease_params).to be_empty
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context 'when an lease is requested with no release date' do
|
|
56
|
+
let(:attributes) { { visibility: described_class::LEASE_REQUEST } }
|
|
57
|
+
|
|
58
|
+
it 'raises an error' do
|
|
59
|
+
expect { intention.lease_params }.to raise_error ArgumentError
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
context 'when lease embargo is requested with valid release date' do
|
|
64
|
+
let(:attributes) do
|
|
65
|
+
{ visibility: described_class::LEASE_REQUEST, release_date: date }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
let(:date) { Time.zone.today }
|
|
69
|
+
|
|
70
|
+
it 'builds public -> private lease' do
|
|
71
|
+
expect(intention.lease_params).to eq [date, described_class::PUBLIC, described_class::PRIVATE]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
context 'when an lease is requested with specific visibilities' do
|
|
76
|
+
let(:attributes) do
|
|
77
|
+
{ visibility: described_class::LEASE_REQUEST,
|
|
78
|
+
release_date: date,
|
|
79
|
+
after: after,
|
|
80
|
+
during: during }
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
let(:after) { 'custom_after_lease_visibility' }
|
|
84
|
+
let(:date) { Time.zone.today }
|
|
85
|
+
let(:during) { 'custom_during_lease_visibility' }
|
|
86
|
+
|
|
87
|
+
it 'builds private -> public embargo' do
|
|
88
|
+
expect(intention.lease_params).to eq [date, during, after]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
describe '#valid_embargo?' do
|
|
94
|
+
it 'is false by default' do
|
|
95
|
+
expect(intention.valid_embargo?).to be_falsey
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
context 'when an embargo is requested with no release date' do
|
|
99
|
+
let(:attributes) { { visibility: described_class::EMBARGO_REQUEST } }
|
|
100
|
+
|
|
101
|
+
it 'is false' do
|
|
102
|
+
expect(intention.valid_embargo?).to be_falsey
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
context 'when an embargo is requested with valid release date' do
|
|
107
|
+
let(:attributes) do
|
|
108
|
+
{ visibility: described_class::EMBARGO_REQUEST, release_date: Time.zone.now.to_s }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'is true' do
|
|
112
|
+
expect(intention.valid_embargo?).to be_truthy
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
describe '#wants_embargo?' do
|
|
118
|
+
it 'is false by default' do
|
|
119
|
+
expect(intention.wants_embargo?).to be_falsey
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context 'when an embargo is requested' do
|
|
123
|
+
let(:attributes) { { visibility: described_class::EMBARGO_REQUEST } }
|
|
124
|
+
|
|
125
|
+
it 'is true' do
|
|
126
|
+
expect(intention.wants_embargo?).to be_truthy
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
describe '#wants_lease?' do
|
|
132
|
+
it 'is false by default' do
|
|
133
|
+
expect(intention.wants_lease?).to be_falsey
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
context 'when a lease is requested' do
|
|
137
|
+
let(:attributes) { { visibility: described_class::LEASE_REQUEST } }
|
|
138
|
+
|
|
139
|
+
it 'is true' do
|
|
140
|
+
expect(intention.wants_lease?).to be_truthy
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|