hyrax 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +3 -0
  3. data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +38 -5
  4. data/app/assets/stylesheets/hyrax/_file_upload.scss +6 -0
  5. data/app/assets/stylesheets/hyrax/controlled_vocabulary.scss +2 -2
  6. data/app/controllers/hyrax/file_sets_controller.rb +1 -1
  7. data/app/controllers/hyrax/single_use_links_viewer_controller.rb +9 -2
  8. data/app/models/collection.rb +13 -1
  9. data/app/models/hyrax/model_registry.rb +1 -1
  10. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -2
  11. data/app/presenters/hyrax/work_show_presenter.rb +2 -2
  12. data/app/services/hyrax/file_set_file_service.rb +10 -1
  13. data/app/services/hyrax/listeners/file_listener.rb +39 -0
  14. data/app/services/hyrax/listeners/file_metadata_listener.rb +0 -30
  15. data/app/services/hyrax/lock_manager.rb +2 -2
  16. data/app/services/hyrax/valkyrie_upload.rb +5 -2
  17. data/app/views/hyrax/uploads/_js_templates.html.erb +9 -9
  18. data/app/views/hyrax/uploads/_js_templates_branding.html.erb +3 -3
  19. data/app/views/hyrax/uploads/_js_templates_versioning.html.erb +1 -1
  20. data/chart/hyrax/Chart.yaml +1 -1
  21. data/chart/hyrax/templates/deployment.yaml +12 -0
  22. data/chart/hyrax/values.yaml +10 -0
  23. data/documentation/developing-your-hyrax-based-app.md +4 -4
  24. data/hyrax.gemspec +2 -8
  25. data/lib/hyrax/publisher.rb +11 -0
  26. data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_work.rb +11 -0
  27. data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +4 -5
  28. data/lib/hyrax/version.rb +1 -1
  29. data/template.rb +1 -1
  30. metadata +44 -78
  31. data/spec/support/book_resource.rb +0 -36
  32. data/spec/support/can_can_overrides.rb +0 -43
  33. data/spec/support/clean_solr.rb +0 -7
  34. data/spec/support/controller_level_helpers.rb +0 -27
  35. data/spec/support/factory_helpers.rb +0 -94
  36. data/spec/support/fakes/fake_actor.rb +0 -22
  37. data/spec/support/fakes/fake_authority.rb +0 -14
  38. data/spec/support/fakes/fake_search_builder_scope.rb +0 -44
  39. data/spec/support/fakes/indexing_adapter.rb +0 -17
  40. data/spec/support/fakes/test_hydra_group_service.rb +0 -55
  41. data/spec/support/features/batch_edit_actions.rb +0 -37
  42. data/spec/support/features/session_helpers.rb +0 -15
  43. data/spec/support/features/workflow.rb +0 -10
  44. data/spec/support/features.rb +0 -11
  45. data/spec/support/form_with_validations.rb +0 -15
  46. data/spec/support/input_support.rb +0 -12
  47. data/spec/support/logging_formatter.rb +0 -67
  48. data/spec/support/matchers/api_responses.rb +0 -27
  49. data/spec/support/matchers/collection_type_property_matchers.rb +0 -30
  50. data/spec/support/matchers/embargo.rb +0 -9
  51. data/spec/support/matchers/lease.rb +0 -9
  52. data/spec/support/matchers/match_valkyrie_ids_with_af_ids.rb +0 -12
  53. data/spec/support/matchers/pcdm_matchers.rb +0 -34
  54. data/spec/support/matchers/permission.rb +0 -31
  55. data/spec/support/matchers/response_matchers.rb +0 -8
  56. data/spec/support/optional_example.rb +0 -17
  57. data/spec/support/rake.rb +0 -42
  58. data/spec/support/selectors.rb +0 -112
  59. data/spec/support/shared_examples_for_collection_presenter.rb +0 -44
  60. data/spec/support/simple_work.rb +0 -28
  61. data/spec/support/spec_statistic.rb +0 -24
  62. data/spec/support/speedup.rb +0 -7
  63. data/spec/support/statistic_helper.rb +0 -10
  64. data/spec/support/valkyrie_indexing.rb +0 -2
  65. data/spec/support/wings_models.rb +0 -9
  66. /data/{spec → lib/hyrax/specs/shared_specs}/factories/access_control.rb +0 -0
  67. /data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets.rb +0 -0
  68. /data/{spec → lib/hyrax/specs/shared_specs}/factories/admin_sets_lw.rb +0 -0
  69. /data/{spec → lib/hyrax/specs/shared_specs}/factories/administrative_sets.rb +0 -0
  70. /data/{spec → lib/hyrax/specs/shared_specs}/factories/api_items.rb +0 -0
  71. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_branding_infos.rb +0 -0
  72. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_type_participants.rb +0 -0
  73. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collection_types.rb +0 -0
  74. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections.rb +0 -0
  75. /data/{spec → lib/hyrax/specs/shared_specs}/factories/collections_factory.rb +0 -0
  76. /data/{spec → lib/hyrax/specs/shared_specs}/factories/content_blocks.rb +0 -0
  77. /data/{spec → lib/hyrax/specs/shared_specs}/factories/counter_metrics.rb +0 -0
  78. /data/{spec → lib/hyrax/specs/shared_specs}/factories/featured_works.rb +0 -0
  79. /data/{spec → lib/hyrax/specs/shared_specs}/factories/file_sets.rb +0 -0
  80. /data/{spec → lib/hyrax/specs/shared_specs}/factories/generic_works.rb +0 -0
  81. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_collection.rb +0 -0
  82. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_default_admin_set.rb +0 -0
  83. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_embargo.rb +0 -0
  84. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_metadata.rb +0 -0
  85. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_file_set.rb +0 -0
  86. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_lease.rb +0 -0
  87. /data/{spec → lib/hyrax/specs/shared_specs}/factories/hyrax_resource.rb +0 -0
  88. /data/{spec → lib/hyrax/specs/shared_specs}/factories/object_id.rb +0 -0
  89. /data/{spec → lib/hyrax/specs/shared_specs}/factories/operations.rb +0 -0
  90. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission.rb +0 -0
  91. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_template_accesses.rb +0 -0
  92. /data/{spec → lib/hyrax/specs/shared_specs}/factories/permission_templates.rb +0 -0
  93. /data/{spec → lib/hyrax/specs/shared_specs}/factories/proxy_deposit_requests.rb +0 -0
  94. /data/{spec → lib/hyrax/specs/shared_specs}/factories/single_use_links.rb +0 -0
  95. /data/{spec → lib/hyrax/specs/shared_specs}/factories/sipity_entities.rb +0 -0
  96. /data/{spec → lib/hyrax/specs/shared_specs}/factories/uploaded_files.rb +0 -0
  97. /data/{spec → lib/hyrax/specs/shared_specs}/factories/users.rb +0 -0
  98. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_actions.rb +0 -0
  99. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflow_states.rb +0 -0
  100. /data/{spec → lib/hyrax/specs/shared_specs}/factories/workflows.rb +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2024-03-01 00:00:00.000000000 Z
17
+ date: 2024-03-29 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -770,16 +770,16 @@ dependencies:
770
770
  name: sprockets
771
771
  requirement: !ruby/object:Gem::Requirement
772
772
  requirements:
773
- - - "~>"
773
+ - - '='
774
774
  - !ruby/object:Gem::Version
775
- version: '3.7'
775
+ version: 3.7.2
776
776
  type: :runtime
777
777
  prerelease: false
778
778
  version_requirements: !ruby/object:Gem::Requirement
779
779
  requirements:
780
- - - "~>"
780
+ - - '='
781
781
  - !ruby/object:Gem::Version
782
- version: '3.7'
782
+ version: 3.7.2
783
783
  - !ruby/object:Gem::Dependency
784
784
  name: sass-rails
785
785
  requirement: !ruby/object:Gem::Requirement
@@ -2387,6 +2387,7 @@ files:
2387
2387
  - app/services/hyrax/listeners/acl_index_listener.rb
2388
2388
  - app/services/hyrax/listeners/active_fedora_acl_index_listener.rb
2389
2389
  - app/services/hyrax/listeners/batch_notification_listener.rb
2390
+ - app/services/hyrax/listeners/file_listener.rb
2390
2391
  - app/services/hyrax/listeners/file_metadata_listener.rb
2391
2392
  - app/services/hyrax/listeners/file_set_lifecycle_listener.rb
2392
2393
  - app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb
@@ -3197,8 +3198,44 @@ files:
3197
3198
  - lib/hyrax/specs/shared_specs.rb
3198
3199
  - lib/hyrax/specs/shared_specs/change_set.rb
3199
3200
  - lib/hyrax/specs/shared_specs/derivative_service.rb
3201
+ - lib/hyrax/specs/shared_specs/factories/access_control.rb
3202
+ - lib/hyrax/specs/shared_specs/factories/admin_sets.rb
3203
+ - lib/hyrax/specs/shared_specs/factories/admin_sets_lw.rb
3204
+ - lib/hyrax/specs/shared_specs/factories/administrative_sets.rb
3205
+ - lib/hyrax/specs/shared_specs/factories/api_items.rb
3206
+ - lib/hyrax/specs/shared_specs/factories/collection_branding_infos.rb
3207
+ - lib/hyrax/specs/shared_specs/factories/collection_type_participants.rb
3208
+ - lib/hyrax/specs/shared_specs/factories/collection_types.rb
3209
+ - lib/hyrax/specs/shared_specs/factories/collections.rb
3210
+ - lib/hyrax/specs/shared_specs/factories/collections_factory.rb
3211
+ - lib/hyrax/specs/shared_specs/factories/content_blocks.rb
3212
+ - lib/hyrax/specs/shared_specs/factories/counter_metrics.rb
3213
+ - lib/hyrax/specs/shared_specs/factories/featured_works.rb
3214
+ - lib/hyrax/specs/shared_specs/factories/file_sets.rb
3215
+ - lib/hyrax/specs/shared_specs/factories/generic_works.rb
3216
+ - lib/hyrax/specs/shared_specs/factories/hyrax_collection.rb
3217
+ - lib/hyrax/specs/shared_specs/factories/hyrax_default_admin_set.rb
3218
+ - lib/hyrax/specs/shared_specs/factories/hyrax_embargo.rb
3219
+ - lib/hyrax/specs/shared_specs/factories/hyrax_file_metadata.rb
3220
+ - lib/hyrax/specs/shared_specs/factories/hyrax_file_set.rb
3221
+ - lib/hyrax/specs/shared_specs/factories/hyrax_lease.rb
3222
+ - lib/hyrax/specs/shared_specs/factories/hyrax_resource.rb
3223
+ - lib/hyrax/specs/shared_specs/factories/hyrax_work.rb
3224
+ - lib/hyrax/specs/shared_specs/factories/object_id.rb
3225
+ - lib/hyrax/specs/shared_specs/factories/operations.rb
3226
+ - lib/hyrax/specs/shared_specs/factories/permission.rb
3227
+ - lib/hyrax/specs/shared_specs/factories/permission_template_accesses.rb
3228
+ - lib/hyrax/specs/shared_specs/factories/permission_templates.rb
3229
+ - lib/hyrax/specs/shared_specs/factories/proxy_deposit_requests.rb
3230
+ - lib/hyrax/specs/shared_specs/factories/single_use_links.rb
3231
+ - lib/hyrax/specs/shared_specs/factories/sipity_entities.rb
3200
3232
  - lib/hyrax/specs/shared_specs/factories/strategies/json_strategy.rb
3201
3233
  - lib/hyrax/specs/shared_specs/factories/strategies/valkyrie_resource.rb
3234
+ - lib/hyrax/specs/shared_specs/factories/uploaded_files.rb
3235
+ - lib/hyrax/specs/shared_specs/factories/users.rb
3236
+ - lib/hyrax/specs/shared_specs/factories/workflow_actions.rb
3237
+ - lib/hyrax/specs/shared_specs/factories/workflow_states.rb
3238
+ - lib/hyrax/specs/shared_specs/factories/workflows.rb
3202
3239
  - lib/hyrax/specs/shared_specs/hydra_works.rb
3203
3240
  - lib/hyrax/specs/shared_specs/identifiers.rb
3204
3241
  - lib/hyrax/specs/shared_specs/indexers.rb
@@ -3299,77 +3336,6 @@ files:
3299
3336
  - lib/wings/valkyrizable.rb
3300
3337
  - package.json
3301
3338
  - samvera-fall-TM3.svg
3302
- - spec/factories/access_control.rb
3303
- - spec/factories/admin_sets.rb
3304
- - spec/factories/admin_sets_lw.rb
3305
- - spec/factories/administrative_sets.rb
3306
- - spec/factories/api_items.rb
3307
- - spec/factories/collection_branding_infos.rb
3308
- - spec/factories/collection_type_participants.rb
3309
- - spec/factories/collection_types.rb
3310
- - spec/factories/collections.rb
3311
- - spec/factories/collections_factory.rb
3312
- - spec/factories/content_blocks.rb
3313
- - spec/factories/counter_metrics.rb
3314
- - spec/factories/featured_works.rb
3315
- - spec/factories/file_sets.rb
3316
- - spec/factories/generic_works.rb
3317
- - spec/factories/hyrax_collection.rb
3318
- - spec/factories/hyrax_default_admin_set.rb
3319
- - spec/factories/hyrax_embargo.rb
3320
- - spec/factories/hyrax_file_metadata.rb
3321
- - spec/factories/hyrax_file_set.rb
3322
- - spec/factories/hyrax_lease.rb
3323
- - spec/factories/hyrax_resource.rb
3324
- - spec/factories/hyrax_work.rb
3325
- - spec/factories/object_id.rb
3326
- - spec/factories/operations.rb
3327
- - spec/factories/permission.rb
3328
- - spec/factories/permission_template_accesses.rb
3329
- - spec/factories/permission_templates.rb
3330
- - spec/factories/proxy_deposit_requests.rb
3331
- - spec/factories/single_use_links.rb
3332
- - spec/factories/sipity_entities.rb
3333
- - spec/factories/uploaded_files.rb
3334
- - spec/factories/users.rb
3335
- - spec/factories/workflow_actions.rb
3336
- - spec/factories/workflow_states.rb
3337
- - spec/factories/workflows.rb
3338
- - spec/support/book_resource.rb
3339
- - spec/support/can_can_overrides.rb
3340
- - spec/support/clean_solr.rb
3341
- - spec/support/controller_level_helpers.rb
3342
- - spec/support/factory_helpers.rb
3343
- - spec/support/fakes/fake_actor.rb
3344
- - spec/support/fakes/fake_authority.rb
3345
- - spec/support/fakes/fake_search_builder_scope.rb
3346
- - spec/support/fakes/indexing_adapter.rb
3347
- - spec/support/fakes/test_hydra_group_service.rb
3348
- - spec/support/features.rb
3349
- - spec/support/features/batch_edit_actions.rb
3350
- - spec/support/features/session_helpers.rb
3351
- - spec/support/features/workflow.rb
3352
- - spec/support/form_with_validations.rb
3353
- - spec/support/input_support.rb
3354
- - spec/support/logging_formatter.rb
3355
- - spec/support/matchers/api_responses.rb
3356
- - spec/support/matchers/collection_type_property_matchers.rb
3357
- - spec/support/matchers/embargo.rb
3358
- - spec/support/matchers/lease.rb
3359
- - spec/support/matchers/match_valkyrie_ids_with_af_ids.rb
3360
- - spec/support/matchers/pcdm_matchers.rb
3361
- - spec/support/matchers/permission.rb
3362
- - spec/support/matchers/response_matchers.rb
3363
- - spec/support/optional_example.rb
3364
- - spec/support/rake.rb
3365
- - spec/support/selectors.rb
3366
- - spec/support/shared_examples_for_collection_presenter.rb
3367
- - spec/support/simple_work.rb
3368
- - spec/support/spec_statistic.rb
3369
- - spec/support/speedup.rb
3370
- - spec/support/statistic_helper.rb
3371
- - spec/support/valkyrie_indexing.rb
3372
- - spec/support/wings_models.rb
3373
3339
  - tasks/benchmark.rake
3374
3340
  - tasks/hyrax_dev.rake
3375
3341
  - template.rb
@@ -3416,7 +3382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3416
3382
  - !ruby/object:Gem::Version
3417
3383
  version: '0'
3418
3384
  requirements: []
3419
- rubygems_version: 3.5.5
3385
+ rubygems_version: 3.5.7
3420
3386
  signing_key:
3421
3387
  specification_version: 4
3422
3388
  summary: Hyrax is a front-end based on the robust Samvera framework, providing a user
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
- module Hyrax
3
- module Test
4
- ##
5
- # A simple Hyrax::Resource with some metadata.
6
- #
7
- # Use this for testing valkyrie models generically, with Hyrax assumptions
8
- # but no PCDM modelling behavior.
9
- class BookResource < Hyrax::Resource
10
- attribute :author, Valkyrie::Types::String
11
- attribute :created, Valkyrie::Types::Date
12
- attribute :isbn, Valkyrie::Types::String
13
- attribute :publisher, Valkyrie::Types::String
14
- attribute :title, Valkyrie::Types::String
15
- end
16
-
17
- ##
18
- # A simple Hyrax::ChangeSet with one custom validation.
19
- #
20
- # Hyrax::Test::BookResource will use this based on naming convention by adding `ChangeSet`
21
- # to the end of the resource class name.
22
- class BookResourceChangeSet < Hyrax::ChangeSet
23
- validates :isbn, presence: true
24
- end
25
-
26
- class Book < ActiveFedora::Base
27
- property :author, predicate: ::RDF::URI('http://example.com/ns/author')
28
- property :created, predicate: ::RDF::URI('http://example.com/ns/created')
29
- property :isbn, predicate: ::RDF::URI('http://example.com/ns/isbn')
30
- property :publisher, predicate: ::RDF::URI('http://example.com/ns/publisher')
31
- property :title, predicate: ::RDF::URI("http://example.com/ns/title")
32
- end
33
- end
34
- end
35
-
36
- Wings::ModelRegistry.register(Hyrax::Test::BookResource, Hyrax::Test::Book) if defined?(Wings)
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
- ##
3
- # This monkey-patch shim is for both active_fedora and valkyrie resources for tests
4
- # This shim handles the case where controllers are loaded with an ActiveFedora collection class
5
- # different than a test mocks Hyrax.config.collection_class.
6
- # This override checks the value in Hyrax.config and uses it when it is a known collection or admin set class.
7
- # This override also memoizes the resource_class to avoid multiple lookups.
8
- CanCan::ControllerResource.class_eval do
9
- def resource_class
10
- return @resource_class if @resource_class.present?
11
- @resource_class = case @options[:class]
12
- when false then
13
- name.to_sym
14
- when nil then
15
- namespaced_name.to_s.camelize.constantize
16
- when String then
17
- @options[:class].constantize
18
- else
19
- @options[:class]
20
- end
21
- @resource_class = dynamically_resolve_class(@resource_class)
22
- end
23
-
24
- private
25
-
26
- def dynamically_resolve_class(resource_class)
27
- if collection_class?(resource_class)
28
- Hyrax.config.collection_class
29
- elsif admin_set_class?(resource_class)
30
- Hyrax.config.admin_set_class
31
- else
32
- resource_class
33
- end
34
- end
35
-
36
- def collection_class?(model_class)
37
- model_class == Hyrax::PcdmCollection || model_class < Hyrax::PcdmCollection || model_class == ::Collection || model_class < ::Collection
38
- end
39
-
40
- def admin_set_class?(model_class)
41
- model_class == Hyrax::AdministrativeSet || model_class < Hyrax::AdministrativeSet || model_class == AdminSet || model_class < AdminSet
42
- end
43
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
- RSpec.configure do |config|
3
- config.before(:each, clean_index: true) do
4
- client = Valkyrie::IndexingAdapter.find(:solr_index).connection
5
- client.delete_by_query("*:*", params: { softCommit: true })
6
- end
7
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ControllerLevelHelpers
4
- # This provides some common mock methods for view tests.
5
- # These are normally provided by the controller.
6
- module ControllerViewHelpers
7
- def search_state
8
- @search_state ||= CatalogController.search_state_class.new(params, blacklight_config, controller)
9
- end
10
-
11
- # This allows you to set the configuration
12
- # @example: view.blacklight_config = Blacklight::Configuration.new
13
- attr_writer :blacklight_config
14
-
15
- def blacklight_config
16
- @blacklight_config ||= CatalogController.blacklight_config
17
- end
18
-
19
- def blacklight_configuration_context
20
- @blacklight_configuration_context ||= Blacklight::Configuration::Context.new(controller)
21
- end
22
- end
23
-
24
- def initialize_controller_helpers(helper)
25
- helper.extend ControllerViewHelpers
26
- end
27
- end
@@ -1,94 +0,0 @@
1
- # frozen_string_literal: true
2
- module Hyrax
3
- module FactoryHelpers
4
- module_function
5
-
6
- FIELDS = { mime_type: 'text/plain',
7
- content: 'content',
8
- file_size: [],
9
- format_label: [],
10
- height: [],
11
- width: [],
12
- filename: [],
13
- well_formed: [],
14
- page_count: [],
15
- file_title: [],
16
- last_modified: [],
17
- original_checksum: [],
18
- alpha_channels: [],
19
- digest: [],
20
- duration: [],
21
- sample_rate: [],
22
- versions: [] }.freeze
23
-
24
- def mock_file_factory(opts = {})
25
- fields = FIELDS.each_with_object({}) do |(name, default), hsh|
26
- hsh[name] = opts.fetch(name, default)
27
- end
28
-
29
- mock_model('MockOriginal', fields)
30
- end
31
-
32
- # as defined in Hyrax::FileMetadata
33
- HYRAX_FILE_METADATA_FIELDS = { file_identifier: '',
34
- alternate_ids: [],
35
- file_set_id: '',
36
- label: [''],
37
- original_filename: '',
38
- mime_type: 'text/plain',
39
- type: [],
40
- format_label: [],
41
- size: [],
42
- well_formed: [],
43
- valid: [],
44
- date_created: [],
45
- fits_version: [],
46
- exif_version: [],
47
- checksum: [],
48
- frame_rate: [],
49
- bit_rate: [],
50
- duration: [],
51
- sample_rate: [],
52
- height: [],
53
- width: [],
54
- bit_depth: [],
55
- channels: [],
56
- data_format: [],
57
- offset: [],
58
- file_title: [],
59
- creator: [],
60
- page_count: [],
61
- language: [],
62
- word_count: [],
63
- character_count: [],
64
- line_count: [],
65
- character_set: [],
66
- markup_basis: [],
67
- markup_language: [],
68
- paragraph_count: [],
69
- table_count: [],
70
- graphics_count: [],
71
- byte_order: [],
72
- compression: [],
73
- color_space: [],
74
- profile_name: [],
75
- profile_version: [],
76
- orientation: [],
77
- color_map: [],
78
- image_producer: [],
79
- capture_device: [],
80
- scanning_software: [],
81
- gps_timestamp: [],
82
- latitude: [],
83
- longitude: [],
84
- aspect_ratio: [] }.freeze
85
-
86
- def mock_file_metadata_factory(opts = {})
87
- fields = HYRAX_FILE_METADATA_FIELDS.each_with_object({}) do |(name, default), hsh|
88
- hsh[name] = opts.fetch(name, default)
89
- end
90
-
91
- mock_model('MockFileMetadata', fields)
92
- end
93
- end
94
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
- class FakeActor < Hyrax::Actors::AbstractActor
3
- attr_accessor :created, :destroyed, :updated
4
-
5
- def create(env)
6
- self.created = env
7
-
8
- true
9
- end
10
-
11
- def destroy(env)
12
- self.destroyed = env
13
-
14
- true
15
- end
16
-
17
- def update(env)
18
- self.updated = env
19
-
20
- true
21
- end
22
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
- class FakeAuthority
3
- def initialize(map)
4
- @map = map
5
- end
6
-
7
- def all
8
- @map
9
- end
10
-
11
- def find(id)
12
- @map.detect { |item| item[:id] == id }
13
- end
14
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- # +Blacklight::SearchBuilder+ requires a 'scope' object, which its documentation
5
- # describes as "the scope where the filter methods reside in."
6
- #
7
- # Often (usually?) this is a Controller with:
8
- # - +#blacklight_config+
9
- # - +#current_ability+
10
- # - +#current_user+
11
- # - +#params+
12
- # - +#repository+
13
- # - +#search_state_class+
14
- #
15
- # This provides a fake scope with more control than a generic RSpec double.
16
- class FakeSearchBuilderScope
17
- ##
18
- # @!attribute [r] blacklight_config
19
- # @return [Blacklight::Configuration]
20
- # @!attribute [r] current_ability
21
- # @return [::Ability]
22
- # @!attribute [r] current_user
23
- # @return [::User, nil]
24
- # @!attribute [r] params
25
- # @return [Hash]
26
- # @!attribute [r] repository
27
- # @return [Blacklight::AbstractRepository]
28
- # @!attribute [r] search_state_class
29
- # @return [Blacklight::SearchState, nil]
30
- attr_reader :blacklight_config, :current_ability, :current_user, :params, :repository, :search_state_class
31
-
32
- ##
33
- # @param [Blacklight::Configuration] blacklight_config
34
- # @param [::Ability, nil] current_ability
35
- # @param [::User, nil] current_user
36
- def initialize(blacklight_config: CatalogController.blacklight_config, current_ability: nil, current_user: nil, params: {}, search_state_class: nil)
37
- @blacklight_config = blacklight_config
38
- @current_user = current_user
39
- @current_ability = current_ability || ::Ability.new(current_user)
40
- @params = params
41
- @repository = Blacklight::Solr::Repository.new(blacklight_config)
42
- @search_state_class = search_state_class
43
- end
44
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
- class FakeIndexingAdapter
3
- attr_reader :deleted_resources, :saved_resources
4
-
5
- def initialize
6
- @deleted_resources = []
7
- @saved_resources = []
8
- end
9
-
10
- def save(resource:)
11
- @saved_resources << resource
12
- end
13
-
14
- def delete(resource:)
15
- @deleted_resources << resource
16
- end
17
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ##
4
- # A fake group service implementation for use in test suites as a drop-in
5
- # replacement for `RoleMapper` or the `hydra-role-management` gem, allowing
6
- # dynamic group assignment backed by in-memory data structures.
7
- #
8
- # @example setup the group service for an rspec test suite
9
- # config.before(:suite) do
10
- # ::User.group_service = TestHydraGroupService.new
11
- # end
12
- #
13
- # @example adding a user to a group
14
- # ::User.group_service.add(user: my_user, groups: ['a_group'])
15
- #
16
- # @example clearing the user -> group map
17
- # ::User.group_service.clear
18
- #
19
- # @see Hydra::User.group_service
20
- class TestHydraGroupService
21
- ##
22
- # @param group_map [Hash{String, Array<String>}] map user keys to group names
23
- def initialize(group_map: {})
24
- @group_map = group_map
25
- end
26
-
27
- ##
28
- # @param user [::User]
29
- # @param groups [Array<String>, String]
30
- #
31
- # @return [void]
32
- def add(user:, groups:)
33
- @group_map[user.user_key] = fetch_groups(user: user) + Array(groups)
34
- end
35
-
36
- ##
37
- # @return [void]
38
- def clear
39
- @group_map = {}
40
- end
41
-
42
- ##
43
- # @param user [::User]
44
- #
45
- # @return [Array<String>]
46
- def fetch_groups(user:)
47
- @group_map.fetch(user.user_key) { [] }
48
- end
49
-
50
- ##
51
- # @return [Array<String>] a list of all known group names
52
- def role_names
53
- @group_map.values.flatten.uniq
54
- end
55
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
- def batch_edit_fields
3
- # skipping based_near because it's a select2 field, which is hard to test via capybara
4
- [
5
- "creator", "contributor", "description", "keyword", "publisher", "date_created",
6
- "subject", "language", "identifier", "related_url"
7
- ]
8
- end
9
-
10
- def fill_in_batch_edit_fields_and_verify!
11
- batch_edit_fields.each do |field_id|
12
- within "#form_#{field_id}" do
13
- batch_edit_expand(field_id)
14
- page.find("##{expected_element_text}_#{field_id}") # Ensuring that the element is on the page before we fill it
15
- fill_in "#{expected_element_text}_#{field_id}", with: "NEW #{field_id}"
16
-
17
- find("##{field_id}_save").click
18
-
19
- ajax_wait(15)
20
- # This was `expect(page).to have_content 'Changes Saved'`, however in debugging,
21
- # the `have_content` check was ignoring the `within` scoping and finding
22
- # "Changes Saved" for other field areas
23
- find('.status', text: 'Changes Saved')
24
- end
25
- end
26
- end
27
-
28
- def batch_edit_expand(field)
29
- find("#expand_link_#{field}").click
30
- yield if block_given?
31
- end
32
-
33
- def ajax_wait(s)
34
- Timeout.timeout(s) do
35
- loop until page.evaluate_script("jQuery.active").zero?
36
- end
37
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
- # spec/support/features/session_helpers.rb
3
- module Features
4
- module SessionHelpers
5
- def sign_in(who = :user)
6
- logout
7
- user = who.is_a?(User) ? who : build(:user).tap(&:save!)
8
- visit new_user_session_path
9
- fill_in 'Email', with: user.email
10
- fill_in 'Password', with: user.password
11
- click_button 'Log in'
12
- expect(page).not_to have_text 'Invalid email or password.'
13
- end
14
- end
15
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
- def ensure_deposit_available_for(user)
3
- template = create(:permission_template, with_admin_set: true, with_workflows: true)
4
- # Grant the user access to deposit into an admin set.
5
- create(:permission_template_access,
6
- :deposit,
7
- permission_template: template,
8
- agent_type: 'user',
9
- agent_id: user.user_key)
10
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
- # spec/support/features.rb
3
- require File.expand_path('../features/session_helpers', __FILE__)
4
- require File.expand_path('../features/workflow', __FILE__)
5
- require File.expand_path('../features/batch_edit_actions', __FILE__)
6
- require File.expand_path('../selectors', __FILE__)
7
- require File.expand_path('../statistic_helper', __FILE__)
8
-
9
- RSpec.configure do |config|
10
- config.include Features::SessionHelpers, type: :feature
11
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
- module Hyrax
3
- module Test
4
- class FormWithValidations < Hyrax::Forms::ResourceForm
5
- property :title
6
-
7
- validates :title, presence: true
8
-
9
- # Added to comply with Hyrax::Forms::FailedSubmissionFormWrapper
10
- def permitted_params
11
- { title: [] }
12
- end
13
- end
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
- module InputSupport
3
- extend ActiveSupport::Concern
4
-
5
- include RSpec::Rails::HelperExampleGroup
6
-
7
- def input_for(object, attribute_name, options = {})
8
- helper.simple_form_for object, url: '' do |f|
9
- f.input attribute_name, options
10
- end
11
- end
12
- end