curation_concerns 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/README.md +11 -4
  4. data/Rakefile +17 -10
  5. data/VERSION +1 -1
  6. data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +4 -9
  7. data/app/controllers/concerns/curation_concerns/download_behavior.rb +7 -1
  8. data/app/forms/curation_concerns/forms/collection_edit_form.rb +29 -0
  9. data/app/helpers/curation_concerns/collections_helper.rb +0 -4
  10. data/app/services/resource_types_service.rb +20 -0
  11. data/app/views/collections/show.html.erb +3 -3
  12. data/app/views/curation_concerns/base/_attribute_rows.html.erb +6 -6
  13. data/app/views/curation_concerns/base/_attributes.html.erb +6 -6
  14. data/app/views/curation_concerns/base/_representative_media.html.erb +1 -1
  15. data/app/views/curation_concerns/base/show.html.erb +2 -2
  16. data/app/views/curation_concerns/file_sets/_show_actions.html.erb +8 -0
  17. data/app/views/curation_concerns/file_sets/show.html.erb +2 -10
  18. data/app/views/curation_concerns/single_use_links_viewer/show.html.erb +1 -1
  19. data/lib/curation_concerns/version.rb +1 -1
  20. data/lib/generators/curation_concerns/install_generator.rb +5 -0
  21. data/lib/generators/curation_concerns/templates/config/authorities/resource_types.yml +41 -0
  22. data/lib/generators/curation_concerns/work/templates/README +1 -1
  23. data/lib/tasks/curation_concerns.rake +10 -0
  24. data/spec/actors/curation_concerns/file_actor_spec.rb +18 -0
  25. data/spec/actors/curation_concerns/file_set_actor_spec.rb +10 -2
  26. data/spec/controllers/curation_concerns/collections_controller_spec.rb +22 -12
  27. data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +17 -4
  28. data/spec/controllers/downloads_controller_spec.rb +8 -0
  29. data/spec/factories/collections.rb +1 -1
  30. data/spec/features/catalog_search_spec.rb +1 -1
  31. data/spec/features/collection_spec.rb +68 -77
  32. data/spec/forms/collection_edit_form_spec.rb +1 -3
  33. data/spec/helpers/curation_concerns/collections_helper_spec.rb +5 -5
  34. data/spec/helpers/url_helper_spec.rb +1 -1
  35. data/spec/inputs/select_with_help_input_spec.rb +1 -1
  36. data/spec/jobs/import_url_job_spec.rb +1 -1
  37. data/spec/jobs/ingest_file_job_spec.rb +23 -3
  38. data/spec/models/checksum_audit_log_spec.rb +1 -1
  39. data/spec/presenters/curation_concerns/collection_presenter_spec.rb +7 -2
  40. data/spec/search_builders/resource_types_service_spec.rb +32 -0
  41. data/spec/spec_helper.rb +1 -0
  42. data/spec/views/catalog/index.html.erb_spec.rb +3 -3
  43. data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +1 -2
  44. data/spec/views/curation_concerns/file_sets/show.html.erb_spec.rb +1 -1
  45. metadata +13 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 645a0115a0467d0f30efdb1f3a0ed2cde1805831
4
- data.tar.gz: 04a720d015cc23c6537bfc5c603c8db8fba6d80c
3
+ metadata.gz: 486de7c9666ed5692b30a092358a383d973ba26e
4
+ data.tar.gz: 0e6d9c42e6ac2d775beb079586d49cd29786ea1e
5
5
  SHA512:
6
- metadata.gz: 2cd5bad72161b60b7c83e52ccaf80082ffaeb24c912f522a1586273b74ed0cbc40923afd3336f0e991259d7c5076f788b275c0abb3b3594e88158d2eefac006c
7
- data.tar.gz: db1f0f7b3de445a107da48e31d6755814437b5c194b683424c37fb2a9d2d65c66547f68d6136621bea2f54a2913d44046c60fac37897cc72850bf448fa35582d
6
+ metadata.gz: 43a18393765b33bf0d05993f2a3867e572901db5f25a4f6c6a373f515fe007c857d3ad4b21bab06c161964382b52f8f2deecd36fd64ce8742cb3305da981a745
7
+ data.tar.gz: 9a68911a9bac50570143d18bceaf09f2b6b1e15b556c588bedd14132a12bbe6871c812014b604ebe15b071bc04659cd301c8b1493e88d215fdeeb65e1c5f97ac
data/.rubocop.yml CHANGED
@@ -56,8 +56,8 @@ Metrics/MethodLength:
56
56
 
57
57
  Metrics/ClassLength:
58
58
  Exclude:
59
+ - curation_concerns-models/lib/curation_concerns/configuration.rb
59
60
  - 'lib/generators/curation_concerns/templates/catalog_controller.rb'
60
- - 'curation_concerns-models/app/models/datastreams/fits_datastream.rb'
61
61
  - 'curation_concerns-models/app/actors/curation_concerns/file_set_actor.rb'
62
62
 
63
63
  Metrics/ModuleLength:
data/README.md CHANGED
@@ -46,8 +46,15 @@ To turn on virus detection, install clamav on your system and add the `clamav` g
46
46
 
47
47
  If you are modifying the curation_concerns gem and want to run the test suite, follow these steps to set up the test environment.
48
48
 
49
+ $ rake ci
50
+
51
+ Or you can do all the steps manually:
52
+
53
+ $ solr_wrapper -p 8985 -d solr/config/ --collection_name hydra-test
54
+
55
+ # in another window
56
+ $ fcrepo_wrapper -p 8986 --no-jms
57
+
58
+ # in another window
49
59
  $ rake engine_cart:generate
50
- $ rake jetty:clean
51
- $ rake jetty:config
52
- $ rake jetty:start
53
- $ rake spec
60
+ $ rake curation_concerns:spec
data/Rakefile CHANGED
@@ -9,22 +9,29 @@ require 'active_fedora/rake_support'
9
9
 
10
10
  Dir.glob('tasks/*.rake').each { |r| import r }
11
11
 
12
- desc 'Run style checker'
13
- RuboCop::RakeTask.new(:rubocop) do |task|
14
- task.requires << 'rubocop-rspec'
15
- task.fail_on_error = true
12
+ namespace :curation_concerns do
13
+ desc 'Run style checker'
14
+ RuboCop::RakeTask.new(:rubocop) do |task|
15
+ task.requires << 'rubocop-rspec'
16
+ task.fail_on_error = true
17
+ end
18
+
19
+ RSpec::Core::RakeTask.new(:rspec)
20
+
21
+ desc 'Run test suite'
22
+ task :spec do
23
+ with_test_server do
24
+ Rake::Task['curation_concerns:rspec'].invoke
25
+ end
26
+ end
16
27
  end
17
28
 
18
29
  desc 'Run test suite and style checker'
19
- task spec: :rubocop do
20
- RSpec::Core::RakeTask.new(:spec)
21
- end
30
+ task spec: ['curation_concerns:rubocop', 'curation_concerns:spec']
22
31
 
23
32
  desc 'Spin up Solr & Fedora and run the test suite'
24
33
  task ci: ['engine_cart:generate'] do
25
- with_test_server do
26
- Rake::Task['spec'].invoke
27
- end
34
+ Rake::Task['spec'].invoke
28
35
  end
29
36
 
30
37
  task clean: 'engine_cart:clean'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.9.0
@@ -34,9 +34,11 @@ module CurationConcerns::CurationConcernController
34
34
  if actor.create
35
35
  after_create_response
36
36
  else
37
- setup_form
38
37
  respond_to do |wants|
39
- wants.html { render 'new', status: :unprocessable_entity }
38
+ wants.html do
39
+ build_form
40
+ render 'new', status: :unprocessable_entity
41
+ end
40
42
  wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) }
41
43
  end
42
44
  end
@@ -68,7 +70,6 @@ module CurationConcerns::CurationConcernController
68
70
  if actor.update
69
71
  after_update_response
70
72
  else
71
- setup_form
72
73
  respond_to do |wants|
73
74
  wants.html do
74
75
  build_form
@@ -117,12 +118,6 @@ module CurationConcerns::CurationConcernController
117
118
  @presenter ||= show_presenter.new(curation_concern_from_search_results, current_ability)
118
119
  end
119
120
 
120
- # Override setup_form in concrete controllers to get the form ready for display
121
- def setup_form
122
- return unless curation_concern.respond_to?(:contributor) && curation_concern.contributor.blank?
123
- curation_concern.contributor << current_user.user_key
124
- end
125
-
126
121
  def _prefixes
127
122
  @_prefixes ||= super + ['curation_concerns/base']
128
123
  end
@@ -21,7 +21,7 @@ module CurationConcerns
21
21
  # For derivatives stored on the local file system
22
22
  response.headers['Accept-Ranges'] = 'bytes'
23
23
  response.headers['Content-Length'] = File.size(file).to_s
24
- send_file file, type: mime_type_for(file), disposition: 'inline'
24
+ send_file file, derivative_download_options
25
25
  else
26
26
  render_404
27
27
  end
@@ -29,6 +29,12 @@ module CurationConcerns
29
29
 
30
30
  protected
31
31
 
32
+ # Override this method if you want to change the options sent when downloading
33
+ # a derivative file
34
+ def derivative_download_options
35
+ { type: mime_type_for(file), disposition: 'inline' }
36
+ end
37
+
32
38
  # Customize the :download ability in your Ability class, or override this method
33
39
  def authorize_download!
34
40
  # authorize! :download, file # can't use this because Hydra::Ability#download_permissions assumes that files are in Basic Container (and thus include the asset's uri)
@@ -18,6 +18,35 @@ module CurationConcerns
18
18
  model_class.validators_on(key).any? { |v| v.is_a? ActiveModel::Validations::PresenceValidator }
19
19
  end
20
20
 
21
+ # The form only supports a single value for title, so use the first
22
+ # @return [String] the first title
23
+ def title
24
+ model.title.first
25
+ end
26
+
27
+ # The form only supports a single value for description, so use the first
28
+ # @return [String] the first description
29
+ def description
30
+ model.description.first
31
+ end
32
+
33
+ # @param [Symbol] key the property to test for cardinality
34
+ # @return [FalseClass,TrueClass] whether the value on the form is singular or multipl
35
+ def self.multiple?(key)
36
+ return false if [:title, :description].include? key
37
+ super
38
+ end
39
+
40
+ # @param [ActiveSupport::Parameters]
41
+ # @return [Hash] a hash suitable for populating Collection attributes.
42
+ def self.model_attributes(_)
43
+ attrs = super
44
+ # cast title and description back to multivalued
45
+ attrs[:title] = Array(attrs[:title]) if attrs[:title]
46
+ attrs[:description] = Array(attrs[:description]) if attrs[:description]
47
+ attrs
48
+ end
49
+
21
50
  # @return [Hash] All generic files in the collection, file.to_s is the key, file.id is the value
22
51
  def select_files
23
52
  Hash[all_files]
@@ -1,8 +1,4 @@
1
1
  module CurationConcerns::CollectionsHelper
2
- def has_collection_search_parameters?
3
- params[:cq].present?
4
- end
5
-
6
2
  def collection_modal_id(collectible)
7
3
  "#{collectible.to_param.tr(':', '-')}-modal"
8
4
  end
@@ -0,0 +1,20 @@
1
+ module ResourceTypesService
2
+ mattr_accessor :authority
3
+ self.authority = Qa::Authorities::Local.subauthority_for('resource_types')
4
+
5
+ def self.select_options
6
+ authority.all.map do |element|
7
+ [element[:label], element[:id]]
8
+ end
9
+ end
10
+
11
+ def self.label(id)
12
+ authority.find(id).fetch('term')
13
+ end
14
+
15
+ # @param [String] id identifier of the resource type
16
+ def self.microdata_type(id)
17
+ I18n.t("curation_concerns.schema_org.resource_type.#{id}",
18
+ default: CurationConcerns.config.microdata_default_type)
19
+ end
20
+ end
@@ -7,13 +7,13 @@
7
7
  <div id="content">
8
8
  <h1 class="lower"><%= @presenter.title %></h1>
9
9
 
10
- <%= render 'curation_concerns/base/representative_media', work: @presenter %>
10
+ <%= render 'curation_concerns/base/representative_media', presenter: @presenter %>
11
11
 
12
12
  <h3><%= @presenter.description %> </h3>
13
13
 
14
14
  <% unless has_collection_search_parameters? %>
15
- <%= render partial: 'collections/show_actions' %>
16
- <%= render 'attributes', curation_concern: @presenter %>
15
+ <%= render 'collections/show_actions' %>
16
+ <%= render 'attributes', presenter: @presenter %>
17
17
  <% end %>
18
18
 
19
19
  <%= render 'search_form' %>
@@ -1,7 +1,7 @@
1
- <%= @presenter.attribute_to_html(:description) %>
2
- <%= @presenter.attribute_to_html(:creator, catalog_search_link: true ) %>
3
- <%= @presenter.attribute_to_html(:contributor, label: 'Contributors', catalog_search_link: true) %>
4
- <%= @presenter.attribute_to_html(:subject, catalog_search_link: true) %>
5
- <%= @presenter.attribute_to_html(:publisher) %>
6
- <%= @presenter.attribute_to_html(:language) %>
1
+ <%= presenter.attribute_to_html(:description) %>
2
+ <%= presenter.attribute_to_html(:creator, catalog_search_link: true ) %>
3
+ <%= presenter.attribute_to_html(:contributor, label: 'Contributors', catalog_search_link: true) %>
4
+ <%= presenter.attribute_to_html(:subject, catalog_search_link: true) %>
5
+ <%= presenter.attribute_to_html(:publisher) %>
6
+ <%= presenter.attribute_to_html(:language) %>
7
7
 
@@ -1,18 +1,18 @@
1
- <table class="table table-striped <%= dom_class(@presenter) %> attributes" <%= @presenter.microdata_type_to_html %>>
1
+ <table class="table table-striped <%= dom_class(presenter) %> attributes" <%= presenter.microdata_type_to_html %>>
2
2
  <caption class="table-heading"><h2>Attributes</h2></caption>
3
3
  <thead>
4
4
  <tr><th>Attribute Name</th><th>Values</th></tr>
5
5
  </thead>
6
6
  <tbody>
7
- <%= render 'attribute_rows' %>
7
+ <%= render 'attribute_rows', presenter: presenter %>
8
8
  <tr>
9
9
  <th>Visibility</th>
10
10
  <td>
11
- <%= @presenter.permission_badge %>
11
+ <%= presenter.permission_badge %>
12
12
  </td>
13
13
  </tr>
14
- <%= @presenter.attribute_to_html(:embargo_release_date) %>
15
- <%= @presenter.attribute_to_html(:lease_expiration_date) %>
16
- <%= @presenter.attribute_to_html(:rights) %>
14
+ <%= presenter.attribute_to_html(:embargo_release_date) %>
15
+ <%= presenter.attribute_to_html(:lease_expiration_date) %>
16
+ <%= presenter.attribute_to_html(:rights) %>
17
17
  </tbody>
18
18
  </table>
@@ -1,4 +1,4 @@
1
- <% if work.representative_id.present? && (fs = ::FileSet.load_instance_from_solr(work.representative_id)) %>
1
+ <% if presenter.representative_id.present? && (fs = ::FileSet.load_instance_from_solr(presenter.representative_id)) %>
2
2
  <%= media_display fs %>
3
3
  <% else %>
4
4
  <%= image_tag 'nope.png', class: "canonical-image" %>
@@ -6,8 +6,8 @@
6
6
  <% collector = can?(:collect, @presenter.id) %>
7
7
  <% editor = can?(:edit, @presenter.id) %>
8
8
 
9
- <%= render 'representative_media', work: @presenter %>
10
- <%= render 'attributes', curation_concern: @presenter %>
9
+ <%= render 'representative_media', presenter: @presenter %>
10
+ <%= render "attributes", presenter: @presenter %>
11
11
  <%= render 'related_files', presenter: @presenter %>
12
12
  <% if editor %>
13
13
  <%= render 'multiple_upload', presenter: @presenter %>
@@ -0,0 +1,8 @@
1
+ <div class="form-actions">
2
+ <%= link_to "Download this File", main_app.download_path(presenter), class: 'btn btn-default' %>
3
+ <% if can? :edit, presenter.id %>
4
+ <%= link_to "Edit this File", edit_polymorphic_path([main_app, presenter]), class: 'btn btn-default' %>
5
+ <% end %>
6
+
7
+ <%= link_to "Back to #{parent.human_readable_type}", parent_path(parent), class: 'btn btn-default' %>
8
+ </div>
@@ -3,13 +3,5 @@
3
3
  <h1>File Details <small><%= @presenter.title %></small></h1>
4
4
  <% end %>
5
5
  <%= media_display @presenter %>
6
- <%= render "attributes", curation_concern: @presenter %>
7
-
8
- <div class="form-actions">
9
- <%= link_to "Download this File", main_app.download_path(@presenter), class: 'btn btn-default' %>
10
- <% if can? :edit, @presenter.id %>
11
- <%= link_to "Edit this File", edit_polymorphic_path([main_app, @presenter]), class: 'btn btn-default' %>
12
- <% end %>
13
-
14
- <%= link_to "Back to #{parent.human_readable_type}", parent_path(parent), class: 'btn btn-default' %>
15
- </div>
6
+ <%= render "attributes", presenter: @presenter %>
7
+ <%= render "show_actions", presenter: @presenter, parent: parent %>
@@ -6,5 +6,5 @@
6
6
  </p>
7
7
  <h2> Descriptions:</h2>
8
8
 
9
- <%= render 'attributes' %>
9
+ <%= render 'attributes', presenter: @presenter %>
10
10
  </div>
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "0.8.0".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
@@ -14,6 +14,7 @@ module CurationConcerns
14
14
  6. Copies the catalog controller into the local app
15
15
  7. Adds CurationConcerns::SolrDocumentBehavior to app/models/solr_document.rb
16
16
  8. Adds config/authorities/rights.yml to the application
17
+ 9. Adds config/authorities/resource_types.yml to the application
17
18
  '
18
19
 
19
20
  def run_required_generators
@@ -102,5 +103,9 @@ module CurationConcerns
102
103
  def rights_config
103
104
  copy_file "config/authorities/rights.yml", "config/authorities/rights.yml"
104
105
  end
106
+
107
+ def resource_types_config
108
+ copy_file "config/authorities/resource_types.yml", "config/authorities/resource_types.yml"
109
+ end
105
110
  end
106
111
  end
@@ -0,0 +1,41 @@
1
+ terms:
2
+ - id: Article
3
+ term: Article
4
+ - id: Audio
5
+ term: Audio
6
+ - id: Book
7
+ term: Book
8
+ - id: Capstone Project
9
+ term: Capstone Project
10
+ - id: Conference Proceeding
11
+ term: Conference Proceeding
12
+ - id: Dataset
13
+ term: Dataset
14
+ - id: Dissertation
15
+ term: Dissertation
16
+ - id: Image
17
+ term: Image
18
+ - id: Journal
19
+ term: Journal
20
+ - id: Map or Cartographic Material
21
+ term: Map or Cartographic Material
22
+ - id: Masters Thesis
23
+ term: Masters Thesis
24
+ - id: Part of Book
25
+ term: Part of Book
26
+ - id: Poster
27
+ term: Poster
28
+ - id: Presentation
29
+ term: Presentation
30
+ - id: Project
31
+ term: Project
32
+ - id: Report
33
+ term: Report
34
+ - id: Research Paper
35
+ term: Research Paper
36
+ - id: Software or Program Code
37
+ term: Software or Program Code
38
+ - id: Video
39
+ term: Video
40
+ - id: Other
41
+ term: Other
@@ -8,6 +8,6 @@ After creating your work you may wish to:
8
8
  CurationConcerns::GenericWorksController; This means that it will use the
9
9
  views found in CurationConcerns::Engine.root/app/views/curation_concerns/base.
10
10
 
11
- 2. Modify the model and datastreams
11
+ 2. Modify the model, actor, form or presenter.
12
12
 
13
13
  ===============================================================================
@@ -0,0 +1,10 @@
1
+ namespace :curation_concerns do
2
+ desc 'Print a count of each object type'
3
+ task count: [:environment] do
4
+ Rails.application.eager_load!
5
+ puts "Number of objects in fedora:"
6
+ ActiveFedora::Base.descendants.each do |model|
7
+ puts " #{model}: #{model.count}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe CurationConcerns::FileActor do
4
+ include ActionDispatch::TestProcess
5
+ let(:user) { create(:user) }
6
+ let(:file_set) { create(:file_set) }
7
+ let(:relation) { create(:file_set) }
8
+ let(:actor) { described_class.new(file_set, 'remastered', user) }
9
+ let(:uploaded_file) { fixture_file_upload('/world.png', 'image/png') }
10
+
11
+ describe '#ingest_file' do
12
+ it 'calls ingest file job' do
13
+ expect(CharacterizeJob).to receive(:perform_later)
14
+ expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key, 'remastered')
15
+ actor.ingest_file(uploaded_file)
16
+ end
17
+ end
18
+ end
@@ -22,7 +22,7 @@ describe CurationConcerns::FileSetActor do
22
22
 
23
23
  before do
24
24
  expect(CharacterizeJob).to receive(:perform_later)
25
- expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key)
25
+ expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key, 'original_file')
26
26
  allow(actor).to receive(:acquire_lock_for).and_yield
27
27
  actor.create_metadata(work)
28
28
  actor.create_content(uploaded_file)
@@ -68,10 +68,18 @@ describe CurationConcerns::FileSetActor do
68
68
  describe '#create_content' do
69
69
  it 'calls ingest file job' do
70
70
  expect(CharacterizeJob).to receive(:perform_later)
71
- expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key)
71
+ expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key, 'original_file')
72
72
  actor.create_content(uploaded_file)
73
73
  end
74
74
 
75
+ context 'when an alternative relationship is specified' do
76
+ it 'calls ingest file job' do
77
+ expect(CharacterizeJob).to receive(:perform_later)
78
+ expect(IngestFileJob).to receive(:perform_later).with(file_set.id, /world\.png$/, 'image/png', user.user_key, 'remastered')
79
+ actor.create_content(uploaded_file, 'remastered')
80
+ end
81
+ end
82
+
75
83
  context 'using ::File' do
76
84
  before do
77
85
  allow(CharacterizeJob).to receive(:perform_later)
@@ -6,14 +6,24 @@ describe CollectionsController do
6
6
  allow_any_instance_of(User).to receive(:groups).and_return([])
7
7
  end
8
8
 
9
- let(:user) { FactoryGirl.create(:user) }
10
- let(:asset1) { FactoryGirl.build(:generic_work, title: ['First of the Assets'], user: user) }
11
- let(:asset2) { FactoryGirl.build(:generic_work, title: ['Second of the Assets'], user: user, depositor: user.user_key) }
12
- let(:asset3) { FactoryGirl.build(:generic_work, title: ['Third of the Assets']) }
13
- let!(:asset4) { FactoryGirl.create(:generic_work, title: ['Fourth of the Assets'], user: user) }
14
- let(:bogus_depositor_asset) { FactoryGirl.create(:generic_work, title: ['Bogus Asset'], depositor: 'abc') }
15
- let(:collection_attrs) { FactoryGirl.attributes_for(:collection, title: 'My First Collection ', description: "The Description\r\n\r\nand more") }
16
- let(:collection) { FactoryGirl.create(:collection, title: 'Collection Title', user: user) }
9
+ let(:user) { create(:user) }
10
+ let(:asset1) { build(:generic_work, title: ['First of the Assets'], user: user) }
11
+ let(:asset2) { build(:generic_work,
12
+ title: ['Second of the Assets'],
13
+ user: user,
14
+ depositor: user.user_key) }
15
+ let(:asset3) { build(:generic_work, title: ['Third of the Assets']) }
16
+ let!(:asset4) { create(:generic_work,
17
+ title: ['Fourth of the Assets'],
18
+ user: user) }
19
+ let(:bogus_depositor_asset) { create(:generic_work,
20
+ title: ['Bogus Asset'],
21
+ depositor: 'abc') }
22
+ let(:collection_attrs) do
23
+ { title: 'My First Collection', description: "The Description\r\n\r\nand more" }
24
+ end
25
+
26
+ let(:collection) { create(:collection, title: ['Collection Title'], user: user) }
17
27
 
18
28
  describe '#new' do
19
29
  before do
@@ -42,7 +52,7 @@ describe CollectionsController do
42
52
  expect do
43
53
  post :create, collection: collection_attrs.merge(creator: [''])
44
54
  end.to change { Collection.count }.by(1)
45
- expect(assigns[:collection].title).to eq('My First Collection ')
55
+ expect(assigns[:collection].title).to eq ['My First Collection']
46
56
  expect(assigns[:collection].creator).to eq([])
47
57
  end
48
58
 
@@ -138,7 +148,7 @@ describe CollectionsController do
138
148
 
139
149
  it 'removes blank strings from params before updating Collection metadata' do
140
150
  put :update, id: collection, collection: collection_attrs.merge(creator: [''])
141
- expect(assigns[:collection].title).to eq('My First Collection ')
151
+ expect(assigns[:collection].title).to eq ['My First Collection']
142
152
  expect(assigns[:collection].creator).to eq([])
143
153
  end
144
154
  end
@@ -160,7 +170,7 @@ describe CollectionsController do
160
170
  get :show, id: collection
161
171
  expect(response).to be_successful
162
172
  expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
163
- expect(assigns[:presenter].title).to eq collection.title
173
+ expect(assigns[:presenter].title).to eq 'Collection Title'
164
174
  expect(assigns[:member_docs].map(&:id)).to match_array [asset1, asset2, asset3].map(&:id)
165
175
  end
166
176
 
@@ -169,7 +179,7 @@ describe CollectionsController do
169
179
  get :show, id: collection, q: 'no matches'
170
180
  expect(response).to be_successful
171
181
  expect(assigns[:presenter]).to be_kind_of CurationConcerns::CollectionPresenter
172
- expect(assigns[:presenter].title).to eq collection.title
182
+ expect(assigns[:presenter].title).to eq 'Collection Title'
173
183
  end
174
184
  end
175
185
  end
@@ -62,11 +62,24 @@ describe CurationConcerns::GenericWorksController do
62
62
  end
63
63
 
64
64
  describe '#create' do
65
- it 'creates a work' do
66
- expect do
65
+ context 'when create is successful' do
66
+ let(:work) { stub_model(GenericWork) }
67
+ it 'creates a work' do
68
+ allow(controller).to receive(:curation_concern).and_return(work)
69
+ expect_any_instance_of(CurationConcerns::GenericWorkActor).to receive(:create).and_return(true)
67
70
  post :create, generic_work: { title: ['a title'] }
68
- end.to change { GenericWork.count }.by(1)
69
- expect(response).to redirect_to main_app.curation_concerns_generic_work_path(assigns[:curation_concern])
71
+ expect(response).to redirect_to main_app.curation_concerns_generic_work_path(work)
72
+ end
73
+ end
74
+
75
+ context 'when create fails' do
76
+ it 'draws the form again' do
77
+ expect_any_instance_of(CurationConcerns::GenericWorkActor).to receive(:create).and_return(false)
78
+ post :create, generic_work: { title: ['a title'] }
79
+ expect(response.status).to eq 422
80
+ expect(assigns[:form]).to be_kind_of CurationConcerns::GenericWorkForm
81
+ expect(response).to render_template 'new'
82
+ end
70
83
  end
71
84
 
72
85
  context 'when not authorized' do
@@ -73,4 +73,12 @@ describe DownloadsController do
73
73
  end
74
74
  end
75
75
  end
76
+
77
+ describe "derivative_download_options" do
78
+ before do
79
+ allow(controller).to receive(:default_file).and_return 'world.png'
80
+ end
81
+ subject { controller.send(:derivative_download_options) }
82
+ it { is_expected.to eq(disposition: 'inline', type: 'image/png') }
83
+ end
76
84
  end
@@ -6,7 +6,7 @@ FactoryGirl.define do
6
6
  user { FactoryGirl.create(:user) }
7
7
  end
8
8
 
9
- title 'Test collection title'
9
+ title ['Test collection title']
10
10
 
11
11
  after(:build) do |collection, evaluator|
12
12
  collection.apply_depositor_metadata(evaluator.user.user_key)
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  feature 'Catalog index page' do
4
4
  let!(:work) { create(:public_generic_work, title: ['My Work']) }
5
- let!(:coll) { create(:collection, :public, title: 'My Collection') }
5
+ let!(:coll) { create(:collection, :public, title: ['My Collection']) }
6
6
 
7
7
  scenario 'Browse the catalog using filter tabs' do
8
8
  visit search_catalog_path
@@ -17,17 +17,10 @@ describe 'collection' do
17
17
  let(:title2) { 'Test Collection 2' }
18
18
  let(:description2) { 'Description for collection 2 we are testing.' }
19
19
 
20
- let(:user) { FactoryGirl.create(:user, email: 'user1@example.com') }
20
+ let(:user) { create(:user, email: 'user1@example.com') }
21
21
  let(:user_key) { user.user_key }
22
- let(:generic_works) do
23
- (0..12).map do |x|
24
- GenericWork.create!(title: ["title #{x}"]) do |f|
25
- f.apply_depositor_metadata('user1@example.com')
26
- end
27
- end
28
- end
29
- let(:gw1) { generic_works[0] }
30
- let(:gw2) { generic_works[1] }
22
+ let(:gw1) { create(:generic_work, user: user, title: ['First test work']) }
23
+ let(:gw2) { create(:generic_work, user: user, title: ['Second test work']) }
31
24
 
32
25
  before(:all) do
33
26
  @old_resque_inline_value = Resque.inline
@@ -64,91 +57,87 @@ describe 'collection' do
64
57
  end
65
58
 
66
59
  describe 'delete collection' do
60
+ let!(:collection) do
61
+ create(:collection, user: user)
62
+ end
63
+
67
64
  before do
68
- @collection = Collection.new title: 'collection title'
69
- @collection.description = 'collection description'
70
- @collection.apply_depositor_metadata(user_key)
71
- @collection.save
72
65
  sign_in user
73
66
  visit main_app.search_catalog_path('f[generic_type_sim][]' => 'Collection', works: 'mine')
74
67
  end
75
68
 
76
69
  it 'deletes a collection' do
77
- expect(page).to have_content(@collection.title)
78
- within("#document_#{@collection.id}") do
70
+ expect(page).to have_content 'Test collection title'
71
+ within("#document_#{collection.id}") do
79
72
  first('.itemtrash').click
80
73
  end
81
- expect(page).to_not have_content(@collection.title)
74
+ expect(page).not_to have_content 'Test collection title'
82
75
  expect(page).to have_content('Collection was successfully deleted.')
83
76
  end
84
77
  end
85
78
 
86
79
  describe 'show collection' do
80
+ let!(:collection) do
81
+ create(:collection, user: user, description: ['collection description'], members: [gw1, gw2])
82
+ end
83
+
87
84
  before do
88
- @collection = FactoryGirl.create(:collection, user: user, title: 'collection title', description: 'collection description')
89
- # @collection = Collection.new title: 'collection title'
90
- # @collection.description = ['collection description']
91
- # @collection.apply_depositor_metadata(user_key)
92
- @collection.members = [gw1, gw2]
93
- @collection.save
94
85
  sign_in user
95
86
  visit search_path_for_my_collections
96
87
  end
97
88
 
98
89
  it 'shows a collection with a listing of Descriptive Metadata and catalog-style search results' do
99
- expect(page).to have_content(@collection.title)
100
- within('#document_' + @collection.id) do
90
+ expect(page).to have_content 'Test collection title'
91
+ within('#document_' + collection.id) do
101
92
  click_link('collection title')
102
93
  end
103
- expect(page).to have_content(@collection.title)
104
- expect(page).to have_content(@collection.description)
94
+ expect(page).to have_content 'Test collection title'
95
+ expect(page).to have_content 'collection description'
105
96
  # Should have search results / contents listing
106
97
  expect(page).to have_content(gw1.title.first)
107
98
  expect(page).to have_content(gw2.title.first)
108
- expect(page).to_not have_css('.pager')
99
+ expect(page).not_to have_css('.pager')
109
100
  end
110
101
 
111
102
  it 'hides collection descriptive metadata when searching a collection' do
112
- expect(page).to have_content(@collection.title)
113
- within("#document_#{@collection.id}") do
103
+ expect(page).to have_content 'Test collection title'
104
+ within("#document_#{collection.id}") do
114
105
  click_link('collection title')
115
106
  end
116
- expect(page).to have_content(@collection.title)
117
- expect(page).to have_content(@collection.description)
107
+ expect(page).to have_content 'Test collection title'
108
+ expect(page).to have_content 'collection description'
118
109
  expect(page).to have_content(gw1.title.first)
119
110
  expect(page).to have_content(gw2.title.first)
120
111
  fill_in('collection_search', with: gw1.title.first)
121
112
  click_button('collection_submit')
122
113
  # Should not have Collection Descriptive metadata table
123
- expect(page).to_not have_content('Descriptions')
124
- expect(page).to have_content(@collection.title)
125
- expect(page).to have_content(@collection.description)
114
+ expect(page).not_to have_content('Descriptions')
115
+ expect(page).to have_content 'Test collection title'
116
+ expect(page).to have_content 'collection description'
126
117
  # Should have search results / contents listing
127
118
  expect(page).to have_content(gw1.title.first)
128
- expect(page).to_not have_content(gw2.title.first)
119
+ expect(page).to have_content(gw2.title.first)
129
120
  # Should not have Dashboard content in contents listing
130
- expect(page).to_not have_content('Visibility')
121
+ expect(page).not_to have_content('Visibility')
131
122
  end
132
123
  end
133
124
 
134
125
  describe 'edit collection' do
126
+ let!(:collection) do
127
+ create(:collection, user: user, description: ['collection description'], members: [gw1, gw2])
128
+ end
135
129
  before do
136
- @collection = Collection.new(title: 'Awesome Title')
137
- @collection.description = 'collection description'
138
- @collection.apply_depositor_metadata(user_key)
139
- @collection.members = [gw1, gw2]
140
- @collection.save
141
130
  sign_in user
142
131
  visit search_path_for_my_collections
143
132
  end
144
133
 
145
134
  it 'edits and update collection metadata' do
146
- expect(page).to have_content(@collection.title)
147
- within("#document_#{@collection.id}") do
135
+ expect(page).to have_content 'Test collection title'
136
+ within("#document_#{collection.id}") do
148
137
  click_link('Edit Collection')
149
138
  end
150
- expect(page).to have_field('collection_title', with: @collection.title)
151
- expect(page).to have_field('collection_description', with: @collection.description)
139
+ expect(page).to have_field('collection_title', with: 'Test collection title')
140
+ expect(page).to have_field('collection_description', with: 'collection description')
152
141
  new_title = 'Altered Title'
153
142
  new_description = 'Completely new Description text.'
154
143
  creators = ['Dorje Trollo', 'Vajrayogini']
@@ -158,8 +147,8 @@ describe 'collection' do
158
147
  # within('.form-actions') do
159
148
  click_button('Update Collection')
160
149
  # end
161
- expect(page).to_not have_content(@collection.title)
162
- expect(page).to_not have_content(@collection.description)
150
+ expect(page).not_to have_content 'Test collection title'
151
+ expect(page).not_to have_content 'collection description'
163
152
  expect(page).to have_content(new_title)
164
153
  expect(page).to have_content(new_description)
165
154
  expect(page).to have_content(creators.first)
@@ -167,7 +156,7 @@ describe 'collection' do
167
156
 
168
157
  context "when there are errors" do
169
158
  it "displays them" do
170
- within("#document_#{@collection.id}") do
159
+ within("#document_#{collection.id}") do
171
160
  click_link('Edit Collection')
172
161
  end
173
162
  fill_in 'Title', with: ''
@@ -177,72 +166,74 @@ describe 'collection' do
177
166
  end
178
167
 
179
168
  it 'removes a work from a collection from edit page' do
180
- expect(page).to have_content(@collection.title)
181
- within("#document_#{@collection.id}") do
169
+ expect(page).to have_content 'Test collection title'
170
+ within("#document_#{collection.id}") do
182
171
  click_link('Edit Collection')
183
172
  end
184
- expect(page).to have_field('collection_title', with: @collection.title)
185
- expect(page).to have_field('collection_description', with: @collection.description)
173
+ expect(page).to have_field 'collection_title', with: 'Test collection title'
174
+ expect(page).to have_field 'collection_description', with: 'collection description'
186
175
  expect(page).to have_content(gw1.title.first)
187
176
  expect(page).to have_content(gw2.title.first)
188
177
  within("#document_#{gw1.id}") do
189
178
  click_link('Remove From Collection')
190
179
  end
191
- expect(page).to have_content(@collection.title)
192
- expect(page).to have_content(@collection.description)
193
- expect(page).to_not have_content(gw1.title.first)
180
+ expect(page).to have_content 'Test collection title'
181
+ expect(page).to have_content 'collection description'
182
+ expect(page).not_to have_content(gw1.title.first)
194
183
  expect(page).to have_content(gw2.title.first)
195
184
  end
196
185
 
197
186
  it 'removes a work from a collection from show page' do
198
- expect(page).to have_content(@collection.title)
199
- within('#document_' + @collection.id) do
200
- click_link(@collection.title)
187
+ expect(page).to have_content 'Test collection title'
188
+ within('#document_' + collection.id) do
189
+ click_link 'Test collection title'
201
190
  end
202
191
  expect(page).to have_content(gw1.title.first)
203
192
  expect(page).to have_content(gw2.title.first)
204
193
  within("#document_#{gw1.id}") do
205
194
  click_link('Remove From Collection')
206
195
  end
207
- expect(page).to have_content(@collection.title)
208
- expect(page).to have_content(@collection.description)
209
- expect(page).to_not have_content(gw1.title.first)
196
+ expect(page).to have_content 'Test collection title'
197
+ expect(page).to have_content 'collection description'
198
+ expect(page).not_to have_content(gw1.title.first)
210
199
  expect(page).to have_content(gw2.title.first)
211
200
  end
212
201
 
213
202
  it 'removes all works from a collection' do
214
203
  skip 'This is from Sufia, not sure if it should be here.'
215
- expect(page).to have_content(@collection.title)
216
- within('#document_' + @collection.id) do
204
+ expect(page).to have_content 'Test collection title'
205
+ within('#document_' + collection.id) do
217
206
  click_link('Edit Collection')
218
207
  end
219
- expect(page).to have_field('collection_title', with: @collection.title)
220
- expect(page).to have_field('collection_description', with: @collection.description)
208
+ expect(page).to have_field 'collection_title', with: 'Test collection title'
209
+ expect(page).to have_field 'collection_description', with: 'collection description'
221
210
  expect(page).to have_content(gw1.title.first)
222
211
  expect(page).to have_content(gw2.title.first)
223
212
  first('input#check_all').click
224
213
  click_link('Remove From Collection')
225
- expect(page).to have_content(@collection.title)
226
- expect(page).to have_content(@collection.description)
227
- expect(page).to_not have_content(gw1.title.first)
228
- expect(page).to_not have_content(gw2.title.first)
214
+ expect(page).to have_content 'Test collection title'
215
+ expect(page).to have_content 'collection description'
216
+ expect(page).not_to have_content(gw1.title.first)
217
+ expect(page).not_to have_content(gw2.title.first)
229
218
  end
230
219
  end
231
220
 
232
221
  describe 'show pages of a collection' do
222
+ let(:generic_works) do
223
+ (0..12).map { create(:generic_work, user: user) }
224
+ end
225
+ let!(:collection) do
226
+ create(:collection, user: user, description: ['collection description'], members: generic_works)
227
+ end
228
+
233
229
  before do
234
- @collection = Collection.new title: 'collection title'
235
- @collection.description = 'collection description'
236
- @collection.apply_depositor_metadata(user_key)
237
- @collection.members = generic_works
238
- @collection.save!
239
230
  sign_in user
240
231
  visit search_path_for_my_collections
241
232
  end
242
233
 
243
234
  it 'shows a collection with a listing of Descriptive Metadata and catalog-style search results' do
244
- expect(page).to have_content(@collection.title)
245
- within('#document_' + @collection.id) do
235
+ expect(page).to have_content 'Test collection title'
236
+ within('#document_' + collection.id) do
246
237
  click_link('collection title')
247
238
  end
248
239
  expect(page).to have_css('.pager')
@@ -65,9 +65,7 @@ describe CurationConcerns::Forms::CollectionEditForm do
65
65
  let(:title) { work.file_sets.first.title.first }
66
66
  let(:file_id) { work.file_sets.first.id }
67
67
  let(:collection_with_file) do
68
- Collection.create!(title: 'foo', members: [work]) do |c|
69
- c.apply_depositor_metadata('jcoyne')
70
- end
68
+ create(:collection, members: [work])
71
69
  end
72
70
 
73
71
  it 'returns a hash of with file title as key and file id as value' do
@@ -35,14 +35,14 @@ describe CurationConcerns::CollectionsHelper do
35
35
  before do
36
36
  allow(helper).to receive(:current_user).and_return(user)
37
37
  end
38
- let(:user) { FactoryGirl.create(:user) }
39
- let!(:collection1) { FactoryGirl.create(:collection, user: user, title: 'One') }
40
- let!(:collection2) { FactoryGirl.create(:collection, user: user, title: 'Two') }
41
- let!(:collection3) { FactoryGirl.create(:collection, user: user, title: 'Three') }
38
+ let(:user) { create(:user) }
39
+ let!(:collection1) { create(:collection, user: user, title: ['One']) }
40
+ let!(:collection2) { create(:collection, user: user, title: ['Two']) }
41
+ let!(:collection3) { create(:collection, user: user, title: ['Three']) }
42
42
  subject { helper.collection_options_for_select(collection2) }
43
43
 
44
44
  it 'excludes the passed in collection' do
45
- expect(subject).to eq "<option value=\"#{collection1.id}\">#{collection1.title}</option>\n<option value=\"#{collection3.id}\">#{collection3.title}</option>"
45
+ expect(subject).to eq "<option value=\"#{collection1.id}\">One</option>\n<option value=\"#{collection3.id}\">Three</option>"
46
46
  end
47
47
  end
48
48
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CurationConcerns::UrlHelper do
4
- let(:profile) { ["{\"datastreams\":{}}"] }
4
+ let(:profile) { ["{}"] }
5
5
  let(:work) { create(:generic_work) }
6
6
  let(:document) { SolrDocument.new(work.to_solr) }
7
7
  subject { helper.url_for_document document }
@@ -11,7 +11,7 @@ describe 'SelectWithHelpInput', type: :input do
11
11
  end
12
12
  end
13
13
  let(:form) { form_class.new(FileSet.new) }
14
- let(:collection) { CurationConcerns.config.resource_types }
14
+ let(:collection) { ResourceTypesService.select_options }
15
15
  let(:base_options) do
16
16
  { as: :select_with_help, collection: collection,
17
17
  input_html: { class: 'form-control', multiple: true } }
@@ -30,7 +30,7 @@ describe ImportUrlJob do
30
30
  allow(CurationConcerns::FileSetActor).to receive(:new).with(file_set, user).and_return(actor)
31
31
  end
32
32
 
33
- it 'creates a content datastream' do
33
+ it 'creates the content' do
34
34
  expect_any_instance_of(Net::HTTP).to receive(:request_get).with(file_hash).and_yield(mock_response)
35
35
  expect(actor).to receive(:create_content).and_return(true)
36
36
  described_class.perform_now(file_set_id)
@@ -5,8 +5,28 @@ describe IngestFileJob do
5
5
  let(:filename) { fixture_file_path('/world.png') }
6
6
  let(:user) { create(:user) }
7
7
 
8
- context 'when givin a mime_type' do
9
- it 'uses a provided mime_type' do
8
+ context 'when given a relationship' do
9
+ before do
10
+ class FileSetWithExtras < FileSet
11
+ directly_contains_one :remastered, through: :files, type: ::RDF::URI('http://pcdm.org/use#IntermediateFile'), class_name: 'Hydra::PCDM::File'
12
+ end
13
+ end
14
+ let(:file_set) do
15
+ FileSetWithExtras.create!(attributes_for(:file_set)) do |file|
16
+ file.apply_depositor_metadata(user.user_key)
17
+ end
18
+ end
19
+ after do
20
+ Object.send(:remove_const, :FileSetWithExtras)
21
+ end
22
+ it 'uses the provided relationship' do
23
+ described_class.perform_now(file_set.id, filename, 'image/png', 'bob', 'remastered')
24
+ expect(file_set.reload.remastered.mime_type).to eq 'image/png'
25
+ end
26
+ end
27
+
28
+ context 'when given a mime_type' do
29
+ it 'uses the provided mime_type' do
10
30
  described_class.perform_now(file_set.id, filename, 'image/png', 'bob')
11
31
  expect(file_set.reload.original_file.mime_type).to eq 'image/png'
12
32
  end
@@ -48,7 +68,7 @@ describe IngestFileJob do
48
68
  end
49
69
  end
50
70
 
51
- describe "the after_create_contentcallback" do
71
+ describe "the after_create_content callback" do
52
72
  subject { CurationConcerns.config.callback }
53
73
  it 'runs with file_set and user arguments' do
54
74
  expect(subject).to receive(:run).with(:after_create_content, file_set, user)
@@ -25,7 +25,7 @@ describe ChecksumAuditLog do
25
25
  let(:new) { described_class.create(file_set_id: f.id, file_id: content_id, version: version_uri, pass: 0, created_at: 1.minute.ago) }
26
26
 
27
27
  context 'a file with multiple checksums audits' do
28
- specify 'should return a list of logs for this datastream sorted by date descending' do
28
+ it 'returns a list of logs for this FileSet sorted by date descending' do
29
29
  logs = described_class.logs_for(f.id, content_id)
30
30
  expect(logs).to eq([new, old])
31
31
  end
@@ -1,8 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe CurationConcerns::CollectionPresenter do
4
- let(:collection) { Collection.new(id: 'adc12v', description: 'a nice collection', title: 'A clever title') }
5
- let(:work) { FactoryGirl.build(:work, title: ['unimaginitive title']) }
4
+ let(:collection) do
5
+ build(:collection,
6
+ id: 'adc12v',
7
+ description: ['a nice collection'],
8
+ title: ['A clever title'])
9
+ end
10
+ let(:work) { build(:work, title: ['unimaginitive title']) }
6
11
  let(:solr_document) { SolrDocument.new(collection.to_solr) }
7
12
  let(:ability) { double }
8
13
  let(:presenter) { described_class.new(solr_document, ability) }
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe ResourceTypesService do
4
+ describe "select_options" do
5
+ subject { described_class.select_options }
6
+
7
+ it "has a select list" do
8
+ expect(subject.first).to eq ["Article", "Article"]
9
+ expect(subject.size).to eq 20
10
+ end
11
+ end
12
+
13
+ describe "label" do
14
+ subject { described_class.label("Video") }
15
+
16
+ it { is_expected.to eq 'Video' }
17
+ end
18
+
19
+ describe "microdata_type" do
20
+ subject { described_class.microdata_type(id) }
21
+
22
+ context "when the id is in the i18n" do
23
+ let(:id) { "Map or Cartographic Material" }
24
+ it { is_expected.to eq 'http://schema.org/Map' }
25
+ end
26
+
27
+ context "when the id is not in the i18n" do
28
+ let(:id) { "missing" }
29
+ it { is_expected.to eq 'http://schema.org/CreativeWork' }
30
+ end
31
+ end
32
+ end
data/spec/spec_helper.rb CHANGED
@@ -33,6 +33,7 @@ if ENV['COVERAGE'] || $in_travis
33
33
  SimpleCov.start('rails') do
34
34
  add_filter '/spec'
35
35
  add_filter '/lib/generators/curation_concerns/templates'
36
+ add_filter '/lib/generators/curation_concerns/install_generator.rb'
36
37
  add_filter '/.internal_test_app'
37
38
  end
38
39
  SimpleCov.command_name('spec')
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'catalog/index.html.erb' do
4
- let(:collection) { stub_model(Collection, title: 'collection1', id: 'abc123') }
4
+ let(:collection) { stub_model(Collection, title: ['collection1'], id: 'abc123') }
5
5
  let(:doc) { SolrDocument.new(collection.to_solr) }
6
6
  let(:search_state) { double('SearchState', to_h: {}) }
7
7
  let(:blacklight_configuration_context) do
@@ -44,7 +44,7 @@ describe 'catalog/index.html.erb' do
44
44
  it 'appears on page without error' do
45
45
  render
46
46
  page = Capybara::Node::Simple.new(rendered)
47
- expect(page).to have_link(collection.title)
47
+ expect(page).to have_link 'collection1'
48
48
  expect(page).to have_content 'List of items deposited'
49
49
  end
50
50
  end
@@ -55,7 +55,7 @@ describe 'catalog/index.html.erb' do
55
55
  it 'appears on page without error' do
56
56
  render
57
57
  page = Capybara::Node::Simple.new(rendered)
58
- expect(page).to have_link(collection.title)
58
+ expect(page).to have_link 'collection1'
59
59
  expect(page).to have_content 'List of items deposited'
60
60
  end
61
61
  end
@@ -19,8 +19,7 @@ describe 'curation_concerns/base/_attributes.html.erb' do
19
19
  before do
20
20
  allow(view).to receive(:dom_class) { '' }
21
21
 
22
- assign(:presenter, presenter)
23
- render
22
+ render 'curation_concerns/base/attributes', presenter: presenter
24
23
  end
25
24
 
26
25
  it 'has links to search for other objects with the same metadata' do
@@ -31,7 +31,7 @@ describe 'curation_concerns/file_sets/show.html.erb', type: :view do
31
31
  let(:presenter) { CurationConcerns::FileSetPresenter.new(solr_doc, ability) }
32
32
 
33
33
  before do
34
- view.lookup_context.view_paths.push CurationConcerns::Engine.root + 'app/views/curation_concerns/base'
34
+ view.lookup_context.prefixes.push 'curation_concerns/base'
35
35
  allow(view).to receive(:can?).with(:edit, String).and_return(true)
36
36
  assign(:presenter, presenter)
37
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-16 00:00:00.000000000 Z
13
+ date: 2016-02-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.8.0
91
+ version: 0.9.0
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.8.0
98
+ version: 0.9.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: hydra-editor
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -532,6 +532,7 @@ files:
532
532
  - app/services/curation_concerns/lease_service.rb
533
533
  - app/services/curation_concerns/parent_service.rb
534
534
  - app/services/curation_concerns/restriction_service.rb
535
+ - app/services/resource_types_service.rb
535
536
  - app/services/rights_service.rb
536
537
  - app/views/catalog/_action_menu_partials/_collection.html.erb
537
538
  - app/views/catalog/_action_menu_partials/_default.html.erb
@@ -614,6 +615,7 @@ files:
614
615
  - app/views/curation_concerns/file_sets/_file_set.html.erb
615
616
  - app/views/curation_concerns/file_sets/_form.html.erb
616
617
  - app/views/curation_concerns/file_sets/_rights_modal.html.erb
618
+ - app/views/curation_concerns/file_sets/_show_actions.html.erb
617
619
  - app/views/curation_concerns/file_sets/edit.html.erb
618
620
  - app/views/curation_concerns/file_sets/jq_upload.json.jbuilder
619
621
  - app/views/curation_concerns/file_sets/media_display/_audio.html.erb
@@ -681,6 +683,7 @@ files:
681
683
  - lib/curation_concerns/version.rb
682
684
  - lib/generators/curation_concerns/install_generator.rb
683
685
  - lib/generators/curation_concerns/templates/catalog_controller.rb
686
+ - lib/generators/curation_concerns/templates/config/authorities/resource_types.yml
684
687
  - lib/generators/curation_concerns/templates/config/authorities/rights.yml
685
688
  - lib/generators/curation_concerns/templates/curation_concerns.js
686
689
  - lib/generators/curation_concerns/templates/curation_concerns.scss
@@ -696,6 +699,7 @@ files:
696
699
  - lib/generators/curation_concerns/work/templates/model.rb.erb
697
700
  - lib/generators/curation_concerns/work/templates/model_spec.rb.erb
698
701
  - lib/generators/curation_concerns/work/work_generator.rb
702
+ - lib/tasks/curation_concerns.rake
699
703
  - solr/config/_rest_managed.json
700
704
  - solr/config/admin-extra.html
701
705
  - solr/config/elevate.xml
@@ -717,6 +721,7 @@ files:
717
721
  - spec/abilities/file_set_abilities_spec.rb
718
722
  - spec/abilities/generic_work_abilities_spec.rb
719
723
  - spec/actors/curation_concerns/embargo_actor_spec.rb
724
+ - spec/actors/curation_concerns/file_actor_spec.rb
720
725
  - spec/actors/curation_concerns/file_set_actor_spec.rb
721
726
  - spec/actors/curation_concerns/lease_actor_spec.rb
722
727
  - spec/actors/curation_concerns/manages_embargoes_actor_spec.rb
@@ -821,6 +826,7 @@ files:
821
826
  - spec/search_builders/curation_concerns/file_set_search_builder_spec.rb
822
827
  - spec/search_builders/curation_concerns/lease_search_builder_spec.rb
823
828
  - spec/search_builders/curation_concerns/search_builder_spec.rb
829
+ - spec/search_builders/resource_types_service_spec.rb
824
830
  - spec/services/derivative_path_spec.rb
825
831
  - spec/services/embargo_service_spec.rb
826
832
  - spec/services/file_set_audit_service_spec.rb
@@ -898,7 +904,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
898
904
  version: '0'
899
905
  requirements: []
900
906
  rubyforge_project:
901
- rubygems_version: 2.4.5.1
907
+ rubygems_version: 2.5.1
902
908
  signing_key:
903
909
  specification_version: 4
904
910
  summary: A Rails Engine that allows an application to CRUD CurationConcern objects
@@ -909,6 +915,7 @@ test_files:
909
915
  - spec/abilities/file_set_abilities_spec.rb
910
916
  - spec/abilities/generic_work_abilities_spec.rb
911
917
  - spec/actors/curation_concerns/embargo_actor_spec.rb
918
+ - spec/actors/curation_concerns/file_actor_spec.rb
912
919
  - spec/actors/curation_concerns/file_set_actor_spec.rb
913
920
  - spec/actors/curation_concerns/lease_actor_spec.rb
914
921
  - spec/actors/curation_concerns/manages_embargoes_actor_spec.rb
@@ -1013,6 +1020,7 @@ test_files:
1013
1020
  - spec/search_builders/curation_concerns/file_set_search_builder_spec.rb
1014
1021
  - spec/search_builders/curation_concerns/lease_search_builder_spec.rb
1015
1022
  - spec/search_builders/curation_concerns/search_builder_spec.rb
1023
+ - spec/search_builders/resource_types_service_spec.rb
1016
1024
  - spec/services/derivative_path_spec.rb
1017
1025
  - spec/services/embargo_service_spec.rb
1018
1026
  - spec/services/file_set_audit_service_spec.rb