curation_concerns 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/app/actors/curation_concerns/actors/abstract_actor.rb +30 -0
  3. data/app/actors/curation_concerns/actors/actor_stack.rb +29 -0
  4. data/app/actors/curation_concerns/actors/add_to_collection_actor.rb +40 -0
  5. data/app/actors/curation_concerns/actors/apply_order_actor.rb +26 -0
  6. data/app/actors/curation_concerns/actors/assign_identifier_actor.rb +9 -0
  7. data/app/actors/curation_concerns/actors/assign_representative_actor.rb +20 -0
  8. data/app/actors/curation_concerns/actors/attach_files_actor.rb +41 -0
  9. data/app/actors/curation_concerns/actors/base_actor.rb +78 -0
  10. data/app/actors/curation_concerns/actors/embargo_actor.rb +21 -0
  11. data/app/actors/curation_concerns/actors/file_actor.rb +81 -0
  12. data/app/actors/curation_concerns/actors/file_set_actor.rb +159 -0
  13. data/app/actors/curation_concerns/actors/interpret_visibility_actor.rb +125 -0
  14. data/app/actors/curation_concerns/actors/lease_actor.rb +21 -0
  15. data/app/actors/curation_concerns/actors/root_actor.rb +19 -0
  16. data/app/actors/curation_concerns/actors/work_actor_behavior.rb +12 -0
  17. data/app/actors/curation_concerns/actors.rb +18 -0
  18. data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +2 -2
  19. data/app/controllers/concerns/curation_concerns/file_sets_controller_behavior.rb +21 -15
  20. data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +2 -2
  21. data/app/forms/curation_concerns/forms/collection_edit_form.rb +1 -1
  22. data/app/forms/curation_concerns/forms/file_set_edit_form.rb +2 -2
  23. data/app/forms/curation_concerns/forms/work_form.rb +1 -1
  24. data/app/forms/curation_concerns/forms.rb +14 -0
  25. data/app/helpers/curation_concerns/collections_helper.rb +10 -8
  26. data/app/jobs/audit_job.rb +0 -2
  27. data/app/jobs/characterize_job.rb +1 -1
  28. data/app/jobs/create_derivatives_job.rb +1 -1
  29. data/app/jobs/import_url_job.rb +2 -2
  30. data/app/jobs/ingest_file_job.rb +1 -1
  31. data/app/jobs/ingest_local_file_job.rb +2 -2
  32. data/app/jobs/resolrize_job.rb +0 -2
  33. data/app/jobs/visibility_copy_job.rb +0 -2
  34. data/app/models/concerns/curation_concerns/basic_metadata.rb +1 -1
  35. data/app/models/concerns/curation_concerns/characterization.rb +41 -0
  36. data/app/models/concerns/curation_concerns/collection.rb +0 -1
  37. data/app/models/concerns/curation_concerns/file_set_behavior.rb +1 -1
  38. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +6 -5
  39. data/app/presenters/curation_concerns/collection_presenter.rb +1 -1
  40. data/app/presenters/curation_concerns/file_set_presenter.rb +1 -1
  41. data/app/presenters/curation_concerns/presents_attributes.rb +1 -1
  42. data/app/renderers/curation_concerns/renderers/attribute_renderer.rb +100 -0
  43. data/app/renderers/curation_concerns/renderers/configured_microdata.rb +42 -0
  44. data/app/renderers/renderers.rb +11 -0
  45. data/app/services/curation_concerns/actors/actor_factory.rb +26 -0
  46. data/app/services/curation_concerns/curation_concern.rb +1 -1
  47. data/app/services/curation_concerns/thumbnail_path_service.rb +1 -1
  48. data/app/views/collections/show.html.erb +7 -3
  49. data/app/views/curation_concerns/base/_representative_media.html.erb +1 -1
  50. data/app/views/curation_concerns/file_sets/show.html.erb +1 -1
  51. data/config/locales/curation_concerns.en.yml +4 -4
  52. data/curation_concerns.gemspec +1 -4
  53. data/lib/curation_concerns/configuration.rb +7 -0
  54. data/lib/curation_concerns/version.rb +1 -1
  55. data/lib/generators/curation_concerns/templates/catalog_controller.rb +4 -4
  56. data/lib/generators/curation_concerns/work/templates/actor.rb.erb +2 -2
  57. data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +1 -1
  58. data/lib/generators/curation_concerns/work/work_generator.rb +2 -2
  59. data/spec/actors/curation_concerns/add_to_collections_actor_spec.rb +6 -6
  60. data/spec/actors/curation_concerns/embargo_actor_spec.rb +1 -1
  61. data/spec/actors/curation_concerns/file_actor_spec.rb +1 -1
  62. data/spec/actors/curation_concerns/file_set_actor_spec.rb +11 -10
  63. data/spec/actors/curation_concerns/interpret_visibility_actor_spec.rb +6 -6
  64. data/spec/actors/curation_concerns/lease_actor_spec.rb +1 -1
  65. data/spec/actors/curation_concerns/work_actor_spec.rb +1 -1
  66. data/spec/controllers/curation_concerns/collections_controller_spec.rb +3 -3
  67. data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +4 -4
  68. data/spec/controllers/embargoes_controller_spec.rb +1 -1
  69. data/spec/controllers/leases_controller_spec.rb +1 -1
  70. data/spec/factories/generic_works.rb +1 -1
  71. data/spec/features/add_file_spec.rb +1 -1
  72. data/spec/features/work_generator_spec.rb +1 -1
  73. data/spec/forms/collection_edit_form_spec.rb +2 -2
  74. data/spec/forms/file_set_edit_form_spec.rb +1 -1
  75. data/spec/forms/work_form_spec.rb +2 -2
  76. data/spec/indexers/file_set_indexer_spec.rb +12 -9
  77. data/spec/jobs/import_url_job_spec.rb +2 -2
  78. data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
  79. data/spec/models/curation_concerns/collection_behavior_spec.rb +12 -3
  80. data/spec/models/file_set_spec.rb +25 -19
  81. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +1 -1
  82. data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +1 -1
  83. data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +2 -2
  84. data/spec/renderers/curation_concerns/{attribute_renderer_spec.rb → renderers/attribute_renderer_spec.rb} +2 -2
  85. data/spec/services/curation_concern_spec.rb +1 -1
  86. data/spec/services/thumbnail_path_service_spec.rb +13 -9
  87. data/spec/support/curation_concerns/factory_helpers.rb +18 -0
  88. metadata +28 -50
  89. data/app/actors/curation_concerns/abstract_actor.rb +0 -28
  90. data/app/actors/curation_concerns/actor_stack.rb +0 -27
  91. data/app/actors/curation_concerns/add_to_collection_actor.rb +0 -38
  92. data/app/actors/curation_concerns/apply_order_actor.rb +0 -24
  93. data/app/actors/curation_concerns/assign_identifier_actor.rb +0 -7
  94. data/app/actors/curation_concerns/assign_representative_actor.rb +0 -18
  95. data/app/actors/curation_concerns/attach_files_actor.rb +0 -39
  96. data/app/actors/curation_concerns/base_actor.rb +0 -76
  97. data/app/actors/curation_concerns/embargo_actor.rb +0 -19
  98. data/app/actors/curation_concerns/file_actor.rb +0 -79
  99. data/app/actors/curation_concerns/file_set_actor.rb +0 -157
  100. data/app/actors/curation_concerns/interpret_visibility_actor.rb +0 -123
  101. data/app/actors/curation_concerns/lease_actor.rb +0 -19
  102. data/app/actors/curation_concerns/root_actor.rb +0 -17
  103. data/app/actors/curation_concerns/work_actor_behavior.rb +0 -8
  104. data/app/renderers/curation_concerns/attribute_renderer.rb +0 -98
  105. data/app/renderers/curation_concerns/configured_microdata.rb +0 -40
  106. data/app/services/curation_concerns/actor_factory.rb +0 -24
@@ -0,0 +1,11 @@
1
+ module CurationConcerns
2
+ # Module that will containing Renderers
3
+ # @since 0.14.0
4
+ # Renderers are used to display Ruby objects to users.
5
+ # Renderers take the Ruby object supplied by a
6
+ # CurationConcerns::Presenter object Renderers are typically # used to respond to read requests from the controller.
7
+ # Renderers may apply some level of HTML or may just supply
8
+ # human readable values for object attributes.
9
+ module Renderers
10
+ end
11
+ end
@@ -0,0 +1,26 @@
1
+ module CurationConcerns
2
+ module Actors
3
+ class ActorFactory
4
+ def self.build(curation_concern, current_user)
5
+ Actors::ActorStack.new(curation_concern,
6
+ current_user,
7
+ stack_actors(curation_concern))
8
+ end
9
+
10
+ def self.stack_actors(curation_concern)
11
+ [AddToCollectionActor,
12
+ AssignRepresentativeActor,
13
+ AttachFilesActor,
14
+ ApplyOrderActor,
15
+ InterpretVisibilityActor,
16
+ model_actor(curation_concern),
17
+ AssignIdentifierActor]
18
+ end
19
+
20
+ def self.model_actor(curation_concern)
21
+ actor_identifier = curation_concern.class.to_s.split('::').last
22
+ "CurationConcerns::Actors::#{actor_identifier}Actor".constantize
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,7 +1,7 @@
1
1
  module CurationConcerns
2
2
  class CurationConcern
3
3
  class_attribute :actor_factory
4
- self.actor_factory = CurationConcerns::ActorFactory
4
+ self.actor_factory = CurationConcerns::Actors::ActorFactory
5
5
 
6
6
  # A consumer of this method can inject a different factory
7
7
  # into this class in order to change the behavior of this method.
@@ -19,7 +19,7 @@ module CurationConcerns
19
19
 
20
20
  def fetch_thumbnail(object)
21
21
  return object if object.thumbnail_id == object.id
22
- ::FileSet.load_instance_from_solr(object.thumbnail_id)
22
+ ::FileSet.find(object.thumbnail_id)
23
23
  rescue ActiveFedora::ObjectNotFoundError
24
24
  Rails.logger.error("Couldn't find thumbnail #{object.thumbnail_id} for #{object.id}")
25
25
  nil
@@ -1,15 +1,19 @@
1
- <% provide :page_title, "#{@presenter.title} - #{application_name}" %>
1
+ <% provide :page_title, "#{@presenter.title.join(', ')} - #{application_name}" %>
2
2
 
3
3
  <% provide :sidebar do %>
4
4
  <%= render 'search_sidebar' %>
5
5
  <% end %>
6
6
 
7
7
  <div id="content">
8
- <h1 class="lower"><%= @presenter.title %></h1>
8
+ <% @presenter.title.each do |title| %>
9
+ <h1 class="lower"><%= title %></h1>
10
+ <% end %>
9
11
 
10
12
  <%= render 'curation_concerns/base/representative_media', presenter: @presenter %>
11
13
 
12
- <h3><%= @presenter.description %> </h3>
14
+ <%= @presenter.description.each do |description| %>
15
+ <h3><%= description %></h3>
16
+ <% end %>
13
17
 
14
18
  <% unless has_collection_search_parameters? %>
15
19
  <%= render 'collections/show_actions' %>
@@ -1,4 +1,4 @@
1
- <% if presenter.representative_id.present? && (fs = ::FileSet.load_instance_from_solr(presenter.representative_id)) %>
1
+ <% if presenter.representative_id.present? && (fs = ::FileSet.find(presenter.representative_id)) %>
2
2
  <%= media_display fs %>
3
3
  <% else %>
4
4
  <%= image_tag 'nope.png', class: "canonical-image" %>
@@ -1,6 +1,6 @@
1
1
  <% provide :page_title, @presenter.page_title %>
2
2
  <% provide :page_header do %>
3
- <h1>File Details <small><%= @presenter.title %></small></h1>
3
+ <h1>File Details <small><%= @presenter %></small></h1>
4
4
  <% end %>
5
5
  <%= media_display @presenter %>
6
6
  <%= render "attributes", presenter: @presenter %>
@@ -83,7 +83,7 @@ en:
83
83
  type: "http://schema.org/Thing"
84
84
  property: about
85
85
  value: name
86
- tag:
86
+ keyword:
87
87
  property: keywords
88
88
  title:
89
89
  property: name
@@ -116,7 +116,7 @@ en:
116
116
  facet:
117
117
  human_readable_type_sim: Type of Work
118
118
  creator_sim: Creator
119
- tag_sim: Keyword
119
+ keyword_sim: Keyword
120
120
  subject_sim: Subject
121
121
  language_sim: Language
122
122
  based_near_sim: Location
@@ -125,7 +125,7 @@ en:
125
125
  generic_type_sim: Type
126
126
  index:
127
127
  description_tesim: "Description"
128
- tag_tesim: "Keyword"
128
+ keyword_tesim: "Keyword"
129
129
  subject_tesim: "Subject"
130
130
  creator_tesim: "Creator"
131
131
  contributor_tesim: "Contributor"
@@ -142,7 +142,7 @@ en:
142
142
  show:
143
143
  title_tesim: "Title"
144
144
  description_tesim: "Description"
145
- tag_tesim: "Keyword"
145
+ keyword_tesim: "Keyword"
146
146
  subject_tesim: "Subject"
147
147
  creator_tesim: "Creator"
148
148
  contributor_tesim: "Contributor"
@@ -29,10 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'sprockets-es6'
30
30
  spec.add_dependency 'kaminari_route_prefix', '~> 0.0.1'
31
31
  spec.add_dependency 'active_attr'
32
- spec.add_dependency 'hydra-works', '~> 0.8', '>= 0.8.1'
33
- # This allows bundler to resolve a dependency tree.
34
- # TODO: I suspect we can remove it when hydra-pcdm 0.8.0 is released.
35
- spec.add_dependency 'hydra-pcdm', '>= 0.8.0.beta1', '< 1'
32
+ spec.add_dependency 'hydra-works', '>= 0.10.0'
36
33
  spec.add_dependency 'active_fedora-noid', '~> 1.0'
37
34
  spec.add_dependency 'qa', '~> 0.5'
38
35
  spec.add_dependency 'redlock', '~> 0.1.2'
@@ -127,6 +127,13 @@ module CurationConcerns
127
127
  @lock_retry_delay ||= 200 # milliseconds
128
128
  end
129
129
 
130
+ # @!attribute [w] ingest_queue_name
131
+ # ActiveJob queue to handle ingest-like jobs.
132
+ attr_writer :ingest_queue_name
133
+ def ingest_queue_name
134
+ @ingest_queue_name ||= :ingest
135
+ end
136
+
130
137
  callback.enable :after_create_concern, :after_create_fileset,
131
138
  :after_update_content, :after_revert_content,
132
139
  :after_update_metadata, :after_import_local_file_success,
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "1.0.0.beta1".freeze
2
+ VERSION = "1.0.0.beta2".freeze
3
3
  end
@@ -25,7 +25,7 @@ class CatalogController < ApplicationController
25
25
  # The ordering of the field names is the order of the display
26
26
  config.add_facet_field solr_name('human_readable_type', :facetable)
27
27
  config.add_facet_field solr_name('creator', :facetable), limit: 5
28
- config.add_facet_field solr_name('tag', :facetable), limit: 5
28
+ config.add_facet_field solr_name('keyword', :facetable), limit: 5
29
29
  config.add_facet_field solr_name('subject', :facetable), limit: 5
30
30
  config.add_facet_field solr_name('language', :facetable), limit: 5
31
31
  config.add_facet_field solr_name('based_near', :facetable), limit: 5
@@ -41,7 +41,7 @@ class CatalogController < ApplicationController
41
41
  # solr fields to be displayed in the index (search results) view
42
42
  # The ordering of the field names is the order of the display
43
43
  config.add_index_field solr_name('description', :stored_searchable)
44
- config.add_index_field solr_name('tag', :stored_searchable)
44
+ config.add_index_field solr_name('keyword', :stored_searchable)
45
45
  config.add_index_field solr_name('subject', :stored_searchable)
46
46
  config.add_index_field solr_name('creator', :stored_searchable)
47
47
  config.add_index_field solr_name('contributor', :stored_searchable)
@@ -194,8 +194,8 @@ class CatalogController < ApplicationController
194
194
  }
195
195
  end
196
196
 
197
- config.add_search_field('tag') do |field|
198
- solr_name = solr_name('tag', :stored_searchable, type: :string)
197
+ config.add_search_field('keyword') do |field|
198
+ solr_name = solr_name('keyword', :stored_searchable, type: :string)
199
199
  field.solr_local_parameters = {
200
200
  qf: solr_name,
201
201
  pf: solr_name
@@ -1,6 +1,6 @@
1
1
  # Generated via
2
2
  # `rails generate curation_concerns:work <%= class_name %>`
3
- module CurationConcerns
4
- class <%= class_name %>Actor < CurationConcerns::BaseActor
3
+ module CurationConcerns::Actors
4
+ class <%= class_name %>Actor < CurationConcerns::Actors::BaseActor
5
5
  end
6
6
  end
@@ -2,7 +2,7 @@
2
2
  # `rails generate curation_concerns:work <%= class_name %>`
3
3
  require 'rails_helper'
4
4
 
5
- describe CurationConcerns::<%= class_name %>Actor do
5
+ describe CurationConcerns::Actors::<%= class_name %>Actor do
6
6
  it "has tests" do
7
7
  skip "Add your tests here"
8
8
  end
@@ -37,7 +37,7 @@ class CurationConcerns::WorkGenerator < Rails::Generators::NamedBase
37
37
 
38
38
  def create_actor_spec
39
39
  return unless rspec_installed?
40
- template('actor_spec.rb.erb', "spec/actors/curation_concerns/#{file_name}_actor_spec.rb")
40
+ template('actor_spec.rb.erb', "spec/actors/curation_concerns/actors/#{file_name}_actor_spec.rb")
41
41
  end
42
42
 
43
43
  def create_form_spec
@@ -55,7 +55,7 @@ class CurationConcerns::WorkGenerator < Rails::Generators::NamedBase
55
55
  end
56
56
 
57
57
  def create_actor
58
- template('actor.rb.erb', "app/actors/curation_concerns/#{file_name}_actor.rb")
58
+ template('actor.rb.erb', "app/actors/curation_concerns/actors/#{file_name}_actor.rb")
59
59
  end
60
60
 
61
61
  def create_form
@@ -1,18 +1,18 @@
1
1
  require 'spec_helper'
2
- describe CurationConcerns::AddToCollectionActor do
2
+ describe CurationConcerns::Actors::AddToCollectionActor do
3
3
  let(:user) { create(:user) }
4
4
  let(:curation_concern) { GenericWork.new }
5
5
  let(:attributes) { {} }
6
6
  subject do
7
- CurationConcerns::ActorStack.new(curation_concern,
8
- user,
9
- [described_class,
10
- CurationConcerns::GenericWorkActor])
7
+ CurationConcerns::Actors::ActorStack.new(curation_concern,
8
+ user,
9
+ [described_class,
10
+ CurationConcerns::Actors::GenericWorkActor])
11
11
  end
12
12
  describe 'the next actor' do
13
13
  let(:root_actor) { double }
14
14
  before do
15
- allow(CurationConcerns::RootActor).to receive(:new).and_return(root_actor)
15
+ allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
16
16
  end
17
17
 
18
18
  let(:attributes) do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CurationConcerns::EmbargoActor do
3
+ describe CurationConcerns::Actors::EmbargoActor do
4
4
  let(:actor) { described_class.new(work) }
5
5
 
6
6
  let(:work) do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CurationConcerns::FileActor do
3
+ describe CurationConcerns::Actors::FileActor do
4
4
  include ActionDispatch::TestProcess
5
5
  let(:user) { create(:user) }
6
6
  let(:file_set) { create(:file_set) }
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
  require 'redlock'
3
3
 
4
- describe CurationConcerns::FileSetActor do
4
+ describe CurationConcerns::Actors::FileSetActor do
5
5
  include ActionDispatch::TestProcess
6
6
 
7
- let(:user) { create(:user) }
8
- let(:file_set) { create(:file_set) }
9
- let(:actor) { described_class.new(file_set, user) }
7
+ let(:user) { create(:user) }
10
8
  let(:uploaded_file) { fixture_file_upload('/world.png', 'image/png') }
11
- let(:local_file) { File.open(File.join(fixture_path, 'world.png')) }
9
+ let(:local_file) { File.open(File.join(fixture_path, 'world.png')) }
10
+ let(:file_set) { create(:file_set, content: local_file) }
11
+ let(:actor) { described_class.new(file_set, user) }
12
12
 
13
13
  describe 'creating metadata and content' do
14
14
  let(:upload_set_id) { nil }
@@ -92,8 +92,8 @@ describe CurationConcerns::FileSetActor do
92
92
  expect(file_set.title).to eq([File.basename(local_file)])
93
93
  end
94
94
 
95
- it 'does not set the mime_type' do
96
- expect(file_set.mime_type).to be_nil
95
+ it 'gets the mime_type from original_file' do
96
+ expect(file_set.mime_type).to eq('image/png')
97
97
  end
98
98
  end
99
99
 
@@ -105,6 +105,7 @@ describe CurationConcerns::FileSetActor do
105
105
 
106
106
  before do
107
107
  allow(CharacterizeJob).to receive(:perform_later)
108
+ allow(IngestFileJob).to receive(:perform_later)
108
109
  allow(file_set).to receive(:label).and_return(short_name)
109
110
  # TODO: we should allow/expect call to IngestJob
110
111
  actor.create_content(fixture_file_upload(file))
@@ -263,7 +264,7 @@ describe CurationConcerns::FileSetActor do
263
264
  describe "#file_actor_class" do
264
265
  context "default" do
265
266
  it "is a FileActor" do
266
- expect(actor.file_actor_class).to eq(CurationConcerns::FileActor)
267
+ expect(actor.file_actor_class).to eq(CurationConcerns::Actors::FileActor)
267
268
  end
268
269
  end
269
270
 
@@ -271,9 +272,9 @@ describe CurationConcerns::FileSetActor do
271
272
  let(:actor) { CustomFileSetActor.new(file_set, user) }
272
273
 
273
274
  before do
274
- class CustomFileActor < CurationConcerns::FileActor
275
+ class CustomFileActor < CurationConcerns::Actors::FileActor
275
276
  end
276
- class CustomFileSetActor < CurationConcerns::FileSetActor
277
+ class CustomFileSetActor < CurationConcerns::Actors::FileSetActor
277
278
  def file_actor_class
278
279
  CustomFileActor
279
280
  end
@@ -1,20 +1,20 @@
1
1
  require 'spec_helper'
2
- describe CurationConcerns::InterpretVisibilityActor do
2
+ describe CurationConcerns::Actors::InterpretVisibilityActor do
3
3
  let(:user) { create(:user) }
4
4
  let(:curation_concern) { GenericWork.new }
5
5
  let(:attributes) { {} }
6
6
  subject do
7
- CurationConcerns::ActorStack.new(curation_concern,
8
- user,
9
- [described_class,
10
- CurationConcerns::GenericWorkActor])
7
+ CurationConcerns::Actors::ActorStack.new(curation_concern,
8
+ user,
9
+ [described_class,
10
+ CurationConcerns::Actors::GenericWorkActor])
11
11
  end
12
12
  let(:date) { Date.today + 2 }
13
13
 
14
14
  describe 'the next actor' do
15
15
  let(:root_actor) { double }
16
16
  before do
17
- allow(CurationConcerns::RootActor).to receive(:new).and_return(root_actor)
17
+ allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
18
18
  end
19
19
 
20
20
  context 'when visibility is set to open' do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe CurationConcerns::LeaseActor do
3
+ describe CurationConcerns::Actors::LeaseActor do
4
4
  let(:actor) { described_class.new(work) }
5
5
 
6
6
  let(:work) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'redlock'
3
3
 
4
- describe CurationConcerns::GenericWorkActor do
4
+ describe CurationConcerns::Actors::GenericWorkActor do
5
5
  include ActionDispatch::TestProcess
6
6
 
7
7
  let(:user) { create(:user) }
@@ -205,7 +205,7 @@ describe CollectionsController do
205
205
  get :show, id: collection
206
206
  expect(response).to be_successful
207
207
  expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
208
- expect(assigns[:presenter].title).to eq 'Collection Title'
208
+ expect(assigns[:presenter].to_s).to eq 'Collection Title'
209
209
  expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map(&:id)
210
210
  end
211
211
 
@@ -214,7 +214,7 @@ describe CollectionsController do
214
214
  get :show, id: collection, q: 'no matches'
215
215
  expect(response).to be_successful
216
216
  expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
217
- expect(assigns[:presenter].title).to eq 'Collection Title'
217
+ expect(assigns[:presenter].to_s).to eq 'Collection Title'
218
218
  end
219
219
  end
220
220
  context 'when the page parameter is passed' do
@@ -222,7 +222,7 @@ describe CollectionsController do
222
222
  get :show, id: collection, page: '2'
223
223
  expect(response).to be_successful
224
224
  expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
225
- expect(assigns[:presenter].title).to eq 'Collection Title'
225
+ expect(assigns[:presenter].to_s).to eq 'Collection Title'
226
226
  end
227
227
  end
228
228
  end
@@ -49,13 +49,13 @@ describe CurationConcerns::FileSetsController do
49
49
  context 'when the file has a virus' do
50
50
  before do
51
51
  allow(subject).to receive(:warn) # suppress virus warnings
52
- allow(ClamAV.instance).to receive(:scanfile).and_return('EL CRAPO VIRUS')
52
+ allow(Hydra::Works::VirusCheckerService).to receive(:file_has_virus?) { true }
53
53
  of = subject.build_original_file
54
54
  of.content = File.open(file_path)
55
55
  end
56
56
  it 'populates the errors hash during validation' do
57
57
  expect(subject).to_not be_valid
58
- expect(subject.errors.messages[:base].first).to match(/A virus was found in .*: EL CRAPO VIRUS/)
58
+ expect(subject.errors.messages[:base].first).to eq "Failed to verify uploaded file is not a virus"
59
59
  end
60
60
  end
61
61
 
@@ -122,7 +122,7 @@ describe CurationConcerns::FileSetsController do
122
122
  context 'updating metadata' do
123
123
  it 'is successful and update attributes' do
124
124
  post :update, id: file_set, file_set:
125
- { title: ['new_title'], tag: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] }
125
+ { title: ['new_title'], keyword: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] }
126
126
  expect(response).to redirect_to main_app.curation_concerns_file_set_path(file_set)
127
127
  expect(assigns[:file_set].title).to eq(['new_title'])
128
128
  end
@@ -130,7 +130,7 @@ describe CurationConcerns::FileSetsController do
130
130
  it 'goes back to edit on an error' do
131
131
  allow_any_instance_of(FileSet).to receive(:valid?).and_return(false)
132
132
  post :update, id: file_set, file_set:
133
- { title: ['new_title'], tag: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] }
133
+ { title: ['new_title'], keyword: [''], permissions_attributes: [{ type: 'person', name: 'archivist1', access: 'edit' }] }
134
134
  expect(response.status).to eq 422
135
135
  expect(response).to render_template('edit')
136
136
  expect(assigns[:groups]).to be_kind_of Array
@@ -49,7 +49,7 @@ describe EmbargoesController do
49
49
 
50
50
  context 'when I have permission to edit the object' do
51
51
  before do
52
- expect(CurationConcerns::EmbargoActor).to receive(:new).with(a_work).and_return(actor)
52
+ expect(CurationConcerns::Actors::EmbargoActor).to receive(:new).with(a_work).and_return(actor)
53
53
  end
54
54
 
55
55
  let(:actor) { double }
@@ -50,7 +50,7 @@ describe LeasesController do
50
50
  context 'when I have permission to edit the object' do
51
51
  let(:actor) { double('lease actor') }
52
52
  before do
53
- allow(CurationConcerns::LeaseActor).to receive(:new).with(a_work).and_return(actor)
53
+ allow(CurationConcerns::Actors::LeaseActor).to receive(:new).with(a_work).and_return(actor)
54
54
  end
55
55
 
56
56
  context 'that has no files' do
@@ -19,7 +19,7 @@ FactoryGirl.define do
19
19
 
20
20
  factory :work_with_one_file do
21
21
  before(:create) do |work, evaluator|
22
- work.ordered_members << FactoryGirl.create(:file_set, user: evaluator.user, title: ['A Contained FileSet'], filename: 'filename.pdf')
22
+ work.ordered_members << FactoryGirl.create(:file_set, user: evaluator.user, title: ['A Contained FileSet'])
23
23
  end
24
24
  end
25
25
 
@@ -8,7 +8,7 @@ feature 'Add an attached file' do
8
8
  sign_in user
9
9
  # stub out characterization. Travis doesn't have fits installed, and it's not relevant to the test.
10
10
  allow(CharacterizeJob).to receive(:perform_later)
11
- allow_any_instance_of(CurationConcerns::FileSetActor).to receive(:acquire_lock_for).and_yield
11
+ allow_any_instance_of(CurationConcerns::Actors::FileSetActor).to receive(:acquire_lock_for).and_yield
12
12
  end
13
13
 
14
14
  it 'updates the file' do
@@ -16,7 +16,7 @@ feature 'Creating a new Work' do
16
16
  Rails::Generators.invoke('curation_concerns:work', ['Catapult'], destination_root: Rails.root)
17
17
  load "#{EngineCart.destination}/app/models/catapult.rb"
18
18
  load "#{EngineCart.destination}/app/controllers/curation_concerns/catapults_controller.rb"
19
- load "#{EngineCart.destination}/app/actors/curation_concerns/catapult_actor.rb"
19
+ load "#{EngineCart.destination}/app/actors/curation_concerns/actors/catapult_actor.rb"
20
20
  load "#{EngineCart.destination}/app/forms/curation_concerns/catapult_form.rb"
21
21
  load "#{EngineCart.destination}/config/initializers/curation_concerns.rb"
22
22
  load "#{EngineCart.destination}/config/routes.rb"
@@ -8,7 +8,7 @@ describe CurationConcerns::Forms::CollectionEditForm do
8
8
  subject { form.terms }
9
9
  it do
10
10
  is_expected.to eq [:resource_type, :title, :creator, :contributor, :description,
11
- :tag, :rights, :publisher, :date_created, :subject, :language,
11
+ :keyword, :rights, :publisher, :date_created, :subject, :language,
12
12
  :representative_id, :thumbnail_id, :identifier, :based_near, :related_url, :visibility]
13
13
  end
14
14
  end
@@ -33,7 +33,7 @@ describe CurationConcerns::Forms::CollectionEditForm do
33
33
  { creator: [] },
34
34
  { contributor: [] },
35
35
  { description: [] },
36
- { tag: [] },
36
+ { keyword: [] },
37
37
  { rights: [] },
38
38
  { publisher: [] },
39
39
  { date_created: [] },
@@ -6,7 +6,7 @@ describe CurationConcerns::Forms::FileSetEditForm do
6
6
  describe '#terms' do
7
7
  it 'returns a list' do
8
8
  expect(subject.terms).to eq(
9
- [:resource_type, :title, :creator, :contributor, :description, :tag,
9
+ [:resource_type, :title, :creator, :contributor, :description, :keyword,
10
10
  :rights, :publisher, :date_created, :subject, :language, :identifier,
11
11
  :based_near, :related_url,
12
12
  :visibility_during_embargo, :visibility_after_embargo, :embargo_release_date,
@@ -45,7 +45,7 @@ describe CurationConcerns::Forms::WorkForm do
45
45
  admin_set_id: '123',
46
46
  representative_id: '456',
47
47
  thumbnail_id: '789',
48
- tag: ['derp'],
48
+ keyword: ['derp'],
49
49
  rights: 'http://creativecommons.org/licenses/by/3.0/us/')
50
50
  }
51
51
  subject { PirateShipForm.model_attributes(params) }
@@ -55,7 +55,7 @@ describe CurationConcerns::Forms::WorkForm do
55
55
  expect(subject['description']).to be_empty
56
56
  expect(subject['visibility']).to eq 'open'
57
57
  expect(subject['rights']).to eq ['http://creativecommons.org/licenses/by/3.0/us/']
58
- expect(subject['tag']).to eq ['derp']
58
+ expect(subject['keyword']).to eq ['derp']
59
59
  end
60
60
 
61
61
  it 'excludes non-permitted params' do
@@ -1,6 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CurationConcerns::FileSetIndexer do
4
+ include CurationConcerns::FactoryHelpers
5
+
4
6
  let(:file_set) do
5
7
  FileSet.new(
6
8
  id: 'foo123',
@@ -19,20 +21,21 @@ describe CurationConcerns::FileSetIndexer do
19
21
  resource_type: ['Book'],
20
22
  identifier: ['urn:isbn:1234567890'],
21
23
  based_near: ['Medina, Saudi Arabia'],
22
- related_url: ['http://example.org/TheWork/'],
23
- mime_type: 'image/jpeg',
24
- format_label: ['JPEG Image']) do |gf|
24
+ related_url: ['http://example.org/TheWork/']) do |gf|
25
25
  gf.full_text.content = 'abcxyz'
26
- gf.height = ['500']
27
- gf.width = ['600']
28
26
  end
29
27
  end
30
28
 
31
29
  let(:mock_file) do
32
- mock_model("MockFile",
33
- content: "asdf",
34
- digest: ["urn:sha1:f794b23c0c6fe1083d0ca8b58261a078cd968967"]
35
- )
30
+ mock_file_factory(
31
+ content: "asdf",
32
+ digest: ["urn:sha1:f794b23c0c6fe1083d0ca8b58261a078cd968967"],
33
+ mime_type: 'image/jpeg',
34
+ format_label: ['JPEG Image'],
35
+ height: ['500'],
36
+ width: ['600'],
37
+ file_size: ['12']
38
+ )
36
39
  end
37
40
  let(:indexer) { described_class.new(file_set) }
38
41
 
@@ -28,7 +28,7 @@ describe ImportUrlJob do
28
28
  before do
29
29
  file_set.id = 'abc123'
30
30
  allow(file_set).to receive(:reload)
31
- allow(CurationConcerns::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
31
+ allow(CurationConcerns::Actors::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
32
32
  end
33
33
 
34
34
  it 'creates the content' do
@@ -49,7 +49,7 @@ describe ImportUrlJob do
49
49
  file_set.save!
50
50
  allow(ActiveFedora::Base).to receive(:find).and_call_original
51
51
  allow(ActiveFedora::Base).to receive(:find).with(file_set_id).and_return(file_set)
52
- allow_any_instance_of(CurationConcerns::FileSetActor).to receive(:create_content)
52
+ allow_any_instance_of(CurationConcerns::Actors::FileSetActor).to receive(:create_content)
53
53
  allow_any_instance_of(Ability).to receive(:can?).and_return(true)
54
54
  expect_any_instance_of(Net::HTTP).to receive(:request_get).with(file_hash).and_yield(mock_response)
55
55
  end
@@ -11,7 +11,7 @@ describe IngestLocalFileJob do
11
11
  before do
12
12
  Dir.mkdir mock_upload_directory unless File.exist? mock_upload_directory
13
13
  FileUtils.copy(File.expand_path('../../fixtures/world.png', __FILE__), mock_upload_directory)
14
- allow(CurationConcerns::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
14
+ allow(CurationConcerns::Actors::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
15
15
  end
16
16
 
17
17
  it 'has attached a file' do