ddr-models 2.4.16 → 2.5.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f83d8acaf696ecb6e92b5958efd1d09c9727acf1
4
- data.tar.gz: d6af219cbb3395901762d0eb5f4a1f60c6b2ce0e
3
+ metadata.gz: 9d6faf41cfbc69e87be3083dede83f8d226253ae
4
+ data.tar.gz: 98a2c8e8eda939beae492194807dbd0dcc824f0c
5
5
  SHA512:
6
- metadata.gz: 76e0f78041619d77258e3877f2dc587cb204e18c75b1be5e85ab7c883ac45ec5dec92cbfc2ab8d77306677d300bb831e2e1ce5dfa7e0e67a41d3f1adeb4a8963
7
- data.tar.gz: 4f6c466ac5ed669cd23babebff7ef3b7cb2a0f62c957b02e6967121f6b75f950e62b77440994cfc7ffc942690be7b5558f0d119f9ffa0747404d5d72517479c3
6
+ metadata.gz: 9785835818f8ab3080c894fcd96a24d6ae812072ca595f09f75e521a257a6f350c6d65d6fc9bc6c0d84a7e1fc4a4dddaf66307e6ef983f51fe1013b4f759fff8
7
+ data.tar.gz: 00aeccc3b05dbce09364f94310e82adf1a0de9a63ea0b708bc0b3e0e591d7e3849febac22b7142cf064d650a33c9d646310852f79a87b6b221761f22a9d4563b
@@ -16,3 +16,9 @@ ActiveSupport::Notifications.subscribe(Ddr::Notifications::UPDATE, Ddr::Events::
16
16
 
17
17
  # Deletion
18
18
  ActiveSupport::Notifications.subscribe(Ddr::Notifications::DELETION, Ddr::Events::DeletionEvent)
19
+ ActiveSupport::Notifications.subscribe(/destroy\.\w+/, Ddr::Events::DeletionEvent)
20
+ ActiveSupport::Notifications.subscribe(/destroy\.\w+/, Ddr::Jobs::PermanentId::MakeUnavailable)
21
+
22
+ # Deaccession
23
+ ActiveSupport::Notifications.subscribe(/deaccession\.\w+/, Ddr::Events::DeaccessionEvent)
24
+ ActiveSupport::Notifications.subscribe(/deaccession\.\w+/, Ddr::Jobs::PermanentId::MakeUnavailable)
@@ -0,0 +1,8 @@
1
+ class AddPermanentIdToEvents < ActiveRecord::Migration
2
+ def change
3
+ change_table :events do |t|
4
+ t.string :permanent_id
5
+ t.index :permanent_id
6
+ end
7
+ end
8
+ end
@@ -36,6 +36,8 @@ module Ddr::Datastreams
36
36
  t.imageWidth
37
37
  t.imageHeight
38
38
  t.colorSpace
39
+ t.iccProfileName
40
+ t.iccProfileVersion
39
41
  }
40
42
  t.document {
41
43
  # TODO - configure to get from Tika?
@@ -63,6 +65,8 @@ module Ddr::Datastreams
63
65
  t.image_width proxy: [:metadata, :image, :imageWidth]
64
66
  t.image_height proxy: [:metadata, :image, :imageHeight]
65
67
  t.color_space proxy: [:metadata, :image, :colorSpace]
68
+ t.icc_profile_name proxy: [:metadata, :image, :iccProfileName]
69
+ t.icc_profile_version proxy: [:metadata, :image, :iccProfileVersion]
66
70
  end
67
71
 
68
72
  def self.xml_template
data/lib/ddr/events.rb CHANGED
@@ -4,6 +4,7 @@ module Ddr
4
4
 
5
5
  autoload :Event
6
6
  autoload :CreationEvent
7
+ autoload :DeaccessionEvent
7
8
  autoload :DeletionEvent
8
9
  autoload :FixityCheckEvent
9
10
  autoload :IngestionEvent
@@ -0,0 +1,8 @@
1
+ module Ddr::Events
2
+ class DeaccessionEvent < Event
3
+ include PreservationEventBehavior
4
+
5
+ self.description = "Object deaccessioned"
6
+ self.preservation_event_type = :dea
7
+ end
8
+ end
@@ -8,13 +8,17 @@ module Ddr::Index
8
8
  ACTIVE_FEDORA_MODEL = Field.new :active_fedora_model, :stored_sortable
9
9
  ADMIN_SET = Field.new :admin_set, :stored_sortable
10
10
  ADMIN_SET_FACET = Field.new :admin_set_facet, :facetable
11
+ ADMIN_SET_TITLE = Field.new :admin_set_title, :stored_sortable
11
12
  ALL_TEXT = Field.new :all_text, solr_name: "all_text_timv"
12
13
  ASPACE_ID = Field.new :aspace_id, :stored_sortable
13
14
  ATTACHED_FILES_HAVING_CONTENT =
14
15
  Field.new :attached_files_having_content, :symbol
15
16
  BOX_NUMBER_FACET = Field.new :box_number_facet, :facetable
17
+ CATEGORY_FACET = Field.new :category_facet, :facetable
16
18
  COLLECTION_FACET = Field.new :collection_facet, :facetable
19
+ COLLECTION_TITLE = Field.new :collection_title, :stored_sortable
17
20
  COLLECTION_URI = Field.new :collection_uri, :symbol
21
+ COMPANY_FACET = Field.new :company_facet, :facetable
18
22
  CONTENT_CONTROL_GROUP = Field.new :content_control_group, :searchable, type: :string
19
23
  CONTENT_CREATE_DATE = Field.new :content_create_date, :stored_sortable, type: :date
20
24
  CONTENT_SIZE = Field.new :content_size, solr_name: "content_size_lsi"
@@ -28,6 +32,7 @@ module Ddr::Index
28
32
  DOI = Field.new :doi, :symbol
29
33
  EAD_ID = Field.new :ead_id, :stored_sortable
30
34
  EXTRACTED_TEXT = Field.new :extracted_text, solr_name: "extracted_text_tsm"
35
+ FOLDER_FACET = Field.new :folder_facet, :facetable
31
36
  FORMAT_FACET = Field.new :format_facet, :facetable
32
37
  HAS_MODEL = Field.new :has_model, :symbol
33
38
  IDENTIFIER_ALL = Field.new :identifier_all, :symbol
@@ -48,6 +53,7 @@ module Ddr::Index
48
53
  MEDIA_SUB_TYPE = Field.new :content_media_sub_type, :facetable
49
54
  MEDIA_MAJOR_TYPE = Field.new :content_media_major_type, :facetable
50
55
  MEDIA_TYPE = Field.new :content_media_type, :symbol
56
+ MEDIUM_FACET = Field.new :medium_facet, :facetable
51
57
  MULTIRES_IMAGE_FILE_PATH = Field.new :multires_image_file_path, :stored_sortable
52
58
  OBJECT_PROFILE = Field.new :object_profile, :displayable
53
59
  OBJECT_STATE = Field.new :object_state, :stored_sortable
@@ -55,11 +61,15 @@ module Ddr::Index
55
61
  OBJECT_MODIFIED_DATE = Field.new :system_modified, :stored_sortable, type: :date
56
62
  PERMANENT_ID = Field.new :permanent_id, :stored_sortable, type: :string
57
63
  PERMANENT_URL = Field.new :permanent_url, :stored_sortable, type: :string
64
+ PLACEMENT_COMPANY_FACET = Field.new :placement_company_facet, :facetable
58
65
  POLICY_ROLE = Field.new :policy_role, :symbol
66
+ PRODUCT_FACET = Field.new :product_facet, :facetable
67
+ PUBLICATION_FACET = Field.new :publication_facet, :facetable
59
68
  PUBLISHER_FACET = Field.new :publisher_facet, :facetable
60
69
  RESEARCH_HELP_CONTACT = Field.new :research_help_contact, :stored_sortable
61
70
  RESOURCE_ROLE = Field.new :resource_role, :symbol
62
71
  SERIES_FACET = Field.new :series_facet, :facetable
72
+ SETTING_FACET = Field.new :setting_facet, :facetable
63
73
  SPATIAL_FACET = Field.new :spatial_facet, :facetable
64
74
  STRUCT_MAPS = Field.new :struct_maps, :stored_sortable
65
75
  SUBJECT_FACET = Field.new :subject_facet, :facetable
@@ -71,6 +81,8 @@ module Ddr::Index
71
81
  TECHMD_FITS_DATETIME = Field.new :techmd_fits_datetime, :stored_sortable, type: :date
72
82
  TECHMD_FORMAT_LABEL = Field.new :techmd_format_label, :symbol
73
83
  TECHMD_FORMAT_VERSION = Field.new :techmd_format_version, :symbol
84
+ TECHMD_ICC_PROFILE_NAME = Field.new :techmd_icc_profile_name, :symbol
85
+ TECHMD_ICC_PROFILE_VERSION = Field.new :techmd_icc_profile_version, :symbol
74
86
  TECHMD_IMAGE_HEIGHT = Field.new :techmd_image_height, :stored_searchable, type: :integer
75
87
  TECHMD_IMAGE_WIDTH = Field.new :techmd_image_width, :stored_searchable, type: :integer
76
88
  TECHMD_MEDIA_TYPE = Field.new :techmd_media_type, :symbol
@@ -79,6 +91,7 @@ module Ddr::Index
79
91
  TECHMD_VALID = Field.new :techmd_valid, :symbol
80
92
  TECHMD_WELL_FORMED = Field.new :techmd_well_formed, :symbol
81
93
  TITLE = Field.new :title, :stored_sortable
94
+ TONE_FACET = Field.new :tone_facet, :facetable
82
95
  TYPE_FACET = Field.new :type_facet, :facetable
83
96
  WORKFLOW_STATE = Field.new :workflow_state, :stored_sortable
84
97
  YEAR_FACET = Field.new :year_facet, solr_name: "year_facet_iim"
@@ -105,8 +118,9 @@ module Ddr::Index
105
118
  return ID
106
119
  end
107
120
  if const = LegacyLicenseFields.const_get(name)
108
- Deprecation.warn(Ddr::Index::Fields,
109
- "`Ddr::Index::Fields::#{name}` is deprecated and will be removed in ddr-models 3.0.")
121
+ # XXX Commented out b/c annoying, but maybe we want later ...
122
+ # Deprecation.warn(Ddr::Index::Fields,
123
+ # "`Ddr::Index::Fields::#{name}` is deprecated and will be removed in ddr-models 3.0.")
110
124
  return const
111
125
  end
112
126
  super
@@ -11,6 +11,18 @@ module Ddr
11
11
  end
12
12
 
13
13
  class MakeUnavailable < Job
14
+ def self.call(*args)
15
+ event = ActiveSupport::Notifications::Event.new(*args)
16
+ id = event.payload[:permanent_id]
17
+ reason = case event.name.split(".").first
18
+ when "destroy"
19
+ "deleted"
20
+ when "deaccession"
21
+ "deaccessioned"
22
+ end
23
+ Resque.enqueue(self, id, reason) if id.present?
24
+ end
25
+
14
26
  def self.perform(id, reason = nil)
15
27
  identifier = Ezid::Identifier.find(id)
16
28
  identifier.unavailable!(reason)
@@ -9,6 +9,7 @@ module Ddr::Managers
9
9
  :media_type, :format_label, :format_version, :pronom_identifier,
10
10
  :created, :modified, :creating_application, :extent,
11
11
  :image_width, :image_height, :color_space,
12
+ :icc_profile_name, :icc_profile_version,
12
13
  to: :fits
13
14
 
14
15
  alias_method :last_modified, :modified
@@ -81,6 +82,8 @@ module Ddr::Managers
81
82
  Ddr::Index::Fields::TECHMD_FILE_SIZE => file_size,
82
83
  Ddr::Index::Fields::TECHMD_FORMAT_LABEL => format_label,
83
84
  Ddr::Index::Fields::TECHMD_FORMAT_VERSION => format_version,
85
+ Ddr::Index::Fields::TECHMD_ICC_PROFILE_NAME => icc_profile_name,
86
+ Ddr::Index::Fields::TECHMD_ICC_PROFILE_VERSION => icc_profile_version,
84
87
  Ddr::Index::Fields::TECHMD_IMAGE_HEIGHT => image_height,
85
88
  Ddr::Index::Fields::TECHMD_IMAGE_WIDTH => image_width,
86
89
  Ddr::Index::Fields::TECHMD_MEDIA_TYPE => media_type,
@@ -9,22 +9,35 @@ module Ddr
9
9
  object.workflow_state == PUBLISHED
10
10
  end
11
11
 
12
- def publish
13
- object.workflow_state = PUBLISHED
12
+
13
+ def publish!(include_descendants: true)
14
+ unless published?
15
+ publish
16
+ object.save!
17
+ end
18
+ if include_descendants && object.respond_to?(:children)
19
+ object.children.each { |child| child.publish!(include_descendants: include_descendants) }
20
+ end
14
21
  end
15
22
 
16
- def publish!
17
- publish
18
- object.save
23
+ def unpublish!
24
+ if published?
25
+ unpublish
26
+ object.save!
27
+ end
28
+ if object.respond_to?(:children)
29
+ object.children.each { |child| child.unpublish! }
30
+ end
19
31
  end
20
32
 
21
- def unpublish
22
- object.workflow_state = UNPUBLISHED
33
+ private
34
+
35
+ def publish
36
+ object.workflow_state = PUBLISHED
23
37
  end
24
38
 
25
- def unpublish!
26
- unpublish
27
- object.save
39
+ def unpublish
40
+ object.workflow_state = UNPUBLISHED
28
41
  end
29
42
 
30
43
  end
@@ -6,13 +6,16 @@ module Ddr::Models
6
6
  self.site = ENV["DDR_AUX_API_URL"]
7
7
 
8
8
  def self.call(obj)
9
- if obj.admin_set
10
- new get(:find, code: obj.admin_set)
11
- end
9
+ find_by_code(obj.admin_set)
12
10
  rescue ActiveResource::ResourceNotFound => e
13
11
  raise Ddr::Models::NotFoundError, e
14
12
  end
15
13
 
14
+ def self.find_by_code(code)
15
+ return unless code
16
+ new get(:find, code: code)
17
+ end
18
+
16
19
  def self.keys
17
20
  all.map(&:code)
18
21
  end
@@ -13,12 +13,23 @@ module Ddr
13
13
  include Hydra::Validations
14
14
  include HasAdminMetadata
15
15
 
16
+ # Prevent accidental use of #delete which lacks callbacks
17
+ private :delete
18
+
19
+ define_model_callbacks :deaccession, only: :around
20
+
16
21
  extend Deprecation
17
22
  # Deprecate Hydra permissions-related methods
18
23
  deprecation_deprecate *(Hydra::AccessControls::Permissions.public_instance_methods)
19
24
 
20
- after_destroy do
21
- notify_event :deletion
25
+ around_save :notify_save
26
+ around_deaccession :notify_deaccession
27
+ around_destroy :notify_destroy
28
+
29
+ def deaccession
30
+ run_callbacks :deaccession do
31
+ delete
32
+ end
22
33
  end
23
34
 
24
35
  def copy_admin_policy_or_permissions_from(other)
@@ -106,6 +117,33 @@ module Ddr
106
117
  raise NotImplementedError, "Must be implemented by subclasses"
107
118
  end
108
119
 
120
+ private
121
+
122
+ def notify_save
123
+ ActiveSupport::Notifications.instrument("save.#{self.class.to_s.underscore}",
124
+ pid: pid,
125
+ changes: changes,
126
+ created: new_record?) do |payload|
127
+ yield
128
+ end
129
+ end
130
+
131
+ def notify_deaccession
132
+ ActiveSupport::Notifications.instrument("deaccession.#{self.class.to_s.underscore}",
133
+ pid: pid,
134
+ permanent_id: permanent_id) do |payload|
135
+ yield
136
+ end
137
+ end
138
+
139
+ def notify_destroy
140
+ ActiveSupport::Notifications.instrument("destroy.#{self.class.to_s.underscore}",
141
+ pid: pid,
142
+ permanent_id: permanent_id) do |payload|
143
+ yield
144
+ end
145
+ end
146
+
109
147
  end
110
148
  end
111
149
  end
@@ -28,7 +28,6 @@ module Ddr::Models
28
28
  delegate :publish!, :unpublish!, :published?, to: :workflow
29
29
 
30
30
  after_create :assign_permanent_id!, if: "Ddr::Models.auto_assign_permanent_ids"
31
- around_destroy :update_permanent_id_on_destroy, if: "permanent_id.present?"
32
31
  end
33
32
 
34
33
  def permanent_id_manager
@@ -17,41 +17,52 @@ module Ddr
17
17
 
18
18
  def index_fields
19
19
  fields = {
20
- ACCESS_ROLE => roles.to_json,
21
- ADMIN_SET => admin_set,
22
- ASPACE_ID => aspace_id,
20
+ ACCESS_ROLE => roles.to_json,
21
+ ADMIN_SET => admin_set,
22
+ ADMIN_SET_TITLE => admin_set_title,
23
+ ASPACE_ID => aspace_id,
23
24
  ATTACHED_FILES_HAVING_CONTENT => attached_files_having_content.keys,
24
- BOX_NUMBER_FACET => desc_metadata_values('box_number'),
25
- CONTRIBUTOR_FACET => contributor,
26
- CREATOR_FACET => creator,
27
- DATE_FACET => date,
28
- DATE_SORT => date_sort,
29
- DEPOSITOR => depositor,
30
- DISPLAY_FORMAT => display_format,
31
- DOI => adminMetadata.doi,
32
- EAD_ID => ead_id,
33
- FORMAT_FACET => format,
34
- IDENTIFIER_ALL => all_identifiers,
35
- INTERNAL_URI => internal_uri,
36
- IS_LOCKED => is_locked,
37
- LICENSE => license,
38
- LICENSE_DESCRIPTION => rightsMetadata.license.description.first,
39
- LICENSE_TITLE => rightsMetadata.license.title.first,
40
- LICENSE_URL => rightsMetadata.license.url.first,
41
- LOCAL_ID => local_id,
42
- PERMANENT_ID => permanent_id,
43
- PERMANENT_URL => permanent_url,
44
- POLICY_ROLE => roles.in_policy_scope.agents,
45
- PUBLISHER_FACET => publisher,
46
- RESEARCH_HELP_CONTACT => research_help_contact,
47
- RESOURCE_ROLE => roles.in_resource_scope.agents,
48
- SERIES_FACET => desc_metadata_values('series'),
49
- SPATIAL_FACET => desc_metadata_values('spatial'),
50
- SUBJECT_FACET => subject,
51
- TITLE => title_display,
52
- TYPE_FACET => type,
53
- WORKFLOW_STATE => workflow_state,
54
- YEAR_FACET => year_facet,
25
+ BOX_NUMBER_FACET => desc_metadata_values('box_number'),
26
+ CATEGORY_FACET => desc_metadata_values('category'),
27
+ COLLECTION_TITLE => collection_title,
28
+ COMPANY_FACET => desc_metadata_values('company'),
29
+ CONTRIBUTOR_FACET => contributor,
30
+ CREATOR_FACET => creator,
31
+ DATE_FACET => date,
32
+ DATE_SORT => date_sort,
33
+ DEPOSITOR => depositor,
34
+ DISPLAY_FORMAT => display_format,
35
+ DOI => adminMetadata.doi,
36
+ EAD_ID => ead_id,
37
+ FOLDER_FACET => desc_metadata_values('folder'),
38
+ FORMAT_FACET => format,
39
+ IDENTIFIER_ALL => all_identifiers,
40
+ INTERNAL_URI => internal_uri,
41
+ IS_LOCKED => is_locked,
42
+ LICENSE => license,
43
+ LICENSE_DESCRIPTION => rightsMetadata.license.description.first,
44
+ LICENSE_TITLE => rightsMetadata.license.title.first,
45
+ LICENSE_URL => rightsMetadata.license.url.first,
46
+ LOCAL_ID => local_id,
47
+ MEDIUM_FACET => desc_metadata_values('medium'),
48
+ PERMANENT_ID => permanent_id,
49
+ PERMANENT_URL => permanent_url,
50
+ PLACEMENT_COMPANY_FACET => desc_metadata_values('placement_company'),
51
+ POLICY_ROLE => roles.in_policy_scope.agents,
52
+ PRODUCT_FACET => desc_metadata_values('product'),
53
+ PUBLICATION_FACET => desc_metadata_values('publication'),
54
+ PUBLISHER_FACET => publisher,
55
+ RESEARCH_HELP_CONTACT => research_help_contact,
56
+ RESOURCE_ROLE => roles.in_resource_scope.agents,
57
+ SERIES_FACET => desc_metadata_values('series'),
58
+ SETTING_FACET => desc_metadata_values('setting'),
59
+ SPATIAL_FACET => desc_metadata_values('spatial'),
60
+ SUBJECT_FACET => subject,
61
+ TITLE => title_display,
62
+ TONE_FACET => desc_metadata_values('tone'),
63
+ TYPE_FACET => type,
64
+ WORKFLOW_STATE => workflow_state,
65
+ YEAR_FACET => year_facet,
55
66
  }
56
67
  if respond_to? :fixity_checks
57
68
  last_fixity_check = fixity_checks.last
@@ -110,6 +121,8 @@ module Ddr
110
121
  end
111
122
 
112
123
  def associated_collection
124
+ # XXX Can/should we use SolrDocument here?
125
+ # I.e., ::SolrDocument.find(admin_policy_id)
113
126
  admin_policy
114
127
  end
115
128
 
@@ -121,10 +134,29 @@ module Ddr
121
134
  end
122
135
  end
123
136
 
137
+ def admin_set_title
138
+ code = if admin_set.present?
139
+ admin_set
140
+ elsif associated_collection.present?
141
+ associated_collection.admin_set
142
+ end
143
+ if as = AdminSet.find_by_code(code)
144
+ as.title
145
+ end
146
+ end
147
+
124
148
  def collection_facet
125
149
  associated_collection.internal_uri if associated_collection.present?
126
150
  end
127
151
 
152
+ def collection_title
153
+ if instance_of?(Collection)
154
+ title_display
155
+ elsif associated_collection.present?
156
+ associated_collection.title_display
157
+ end
158
+ end
159
+
128
160
  def date_sort
129
161
  date.first
130
162
  end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "2.4.16"
3
+ VERSION = "2.5.0.rc1"
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20150713171838) do
14
+ ActiveRecord::Schema.define(version: 20161021201011) do
15
15
 
16
16
  create_table "events", force: true do |t|
17
17
  t.datetime "event_date_time"
@@ -27,10 +27,12 @@ ActiveRecord::Schema.define(version: 20150713171838) do
27
27
  t.text "detail"
28
28
  t.text "exception", limit: 65535
29
29
  t.string "user_key"
30
+ t.string "permanent_id"
30
31
  end
31
32
 
32
33
  add_index "events", ["event_date_time"], name: "index_events_on_event_date_time"
33
34
  add_index "events", ["outcome"], name: "index_events_on_outcome"
35
+ add_index "events", ["permanent_id"], name: "index_events_on_permanent_id"
34
36
  add_index "events", ["pid"], name: "index_events_on_pid"
35
37
  add_index "events", ["type"], name: "index_events_on_type"
36
38
 
@@ -12,6 +12,8 @@ module Ddr::Index
12
12
  Fields::TECHMD_FITS_DATETIME,
13
13
  Fields::TECHMD_FORMAT_LABEL,
14
14
  Fields::TECHMD_FORMAT_VERSION,
15
+ Fields::TECHMD_ICC_PROFILE_NAME,
16
+ Fields::TECHMD_ICC_PROFILE_VERSION,
15
17
  Fields::TECHMD_IMAGE_HEIGHT,
16
18
  Fields::TECHMD_IMAGE_WIDTH,
17
19
  Fields::TECHMD_MEDIA_TYPE,
@@ -60,6 +62,18 @@ module Ddr::Index
60
62
  its(:heading) { is_expected.to eq "aspace_id" }
61
63
  end
62
64
 
65
+ describe "CATEGORY_FACET" do
66
+ subject { Fields::CATEGORY_FACET }
67
+ its(:label) { is_expected.to eq "Category Facet" }
68
+ its(:heading) { is_expected.to eq "category_facet" }
69
+ end
70
+
71
+ describe "COMPANY_FACET" do
72
+ subject { Fields::COMPANY_FACET }
73
+ its(:label) { is_expected.to eq "Company Facet" }
74
+ its(:heading) { is_expected.to eq "company_facet" }
75
+ end
76
+
63
77
  describe "DOI" do
64
78
  subject { Fields::DOI }
65
79
  its(:label) { is_expected.to eq "DOI" }
@@ -72,12 +86,24 @@ module Ddr::Index
72
86
  its(:heading) { is_expected.to eq "ead_id" }
73
87
  end
74
88
 
89
+ describe "FOLDER_FACET" do
90
+ subject { Fields::FOLDER_FACET }
91
+ its(:label) { is_expected.to eq "Folder Facet" }
92
+ its(:heading) { is_expected.to eq "folder_facet" }
93
+ end
94
+
75
95
  describe "LOCAL_ID" do
76
96
  subject { Fields::LOCAL_ID }
77
97
  its(:label) { is_expected.to eq "Local ID" }
78
98
  its(:heading) { is_expected.to eq "local_id" }
79
99
  end
80
100
 
101
+ describe "MEDIUM_FACET" do
102
+ subject { Fields::MEDIUM_FACET }
103
+ its(:label) { is_expected.to eq "Medium Facet" }
104
+ its(:heading) { is_expected.to eq "medium_facet" }
105
+ end
106
+
81
107
  describe "OBJECT_CREATE_DATE" do
82
108
  subject { Fields::OBJECT_CREATE_DATE }
83
109
  its(:label) { is_expected.to eq "Creation Date" }
@@ -102,6 +128,30 @@ module Ddr::Index
102
128
  its(:heading) { is_expected.to eq "permanent_url" }
103
129
  end
104
130
 
131
+ describe "PLACEMENT_COMPANY_FACET" do
132
+ subject { Fields::PLACEMENT_COMPANY_FACET }
133
+ its(:label) { is_expected.to eq "Placement Company Facet" }
134
+ its(:heading) { is_expected.to eq "placement_company_facet" }
135
+ end
136
+
137
+ describe "PRODUCT_FACET" do
138
+ subject { Fields::PRODUCT_FACET }
139
+ its(:label) { is_expected.to eq "Product Facet" }
140
+ its(:heading) { is_expected.to eq "product_facet" }
141
+ end
142
+
143
+ describe "PUBLICATION_FACET" do
144
+ subject { Fields::PUBLICATION_FACET }
145
+ its(:label) { is_expected.to eq "Publication Facet" }
146
+ its(:heading) { is_expected.to eq "publication_facet" }
147
+ end
148
+
149
+ describe "SETTING_FACET" do
150
+ subject { Fields::SETTING_FACET }
151
+ its(:label) { is_expected.to eq "Setting Facet" }
152
+ its(:heading) { is_expected.to eq "setting_facet" }
153
+ end
154
+
105
155
  describe "TECHMD_COLOR_SPACE" do
106
156
  subject { Fields::TECHMD_COLOR_SPACE }
107
157
  its(:label) { is_expected.to eq "Color Space" }
@@ -191,6 +241,12 @@ module Ddr::Index
191
241
  its(:label) { is_expected.to eq "Well-formed" }
192
242
  its(:heading) { is_expected.to eq "well_formed" }
193
243
  end
244
+
245
+ describe "TONE_FACET" do
246
+ subject { Fields::TONE_FACET }
247
+ its(:label) { is_expected.to eq "Tone Facet" }
248
+ its(:heading) { is_expected.to eq "tone_facet" }
249
+ end
194
250
  end
195
251
 
196
252
  end
@@ -72,6 +72,8 @@ module Ddr::Managers
72
72
  its(:image_width) { is_expected.to eq(["500"]) }
73
73
  its(:image_height) { is_expected.to eq(["569"]) }
74
74
  its(:color_space) { is_expected.to eq(["YCbCr"]) }
75
+ its(:icc_profile_name) { is_expected.to eq(["c2"]) }
76
+ its(:icc_profile_version) { is_expected.to eq(["2.1.0"]) }
75
77
  end
76
78
 
77
79
  describe "valid? / invalid?" do
@@ -6,19 +6,20 @@ module Ddr::Models
6
6
 
7
7
  describe "when the object has an admin set" do
8
8
  before { obj.admin_set = "dvs" }
9
+ let(:admin_set) {
10
+ described_class.new("id"=>1, "code"=>"dvs", "title"=>"Data and Visualization Services", "created_at"=>"2015-09-15T16:15:58.514Z", "updated_at"=>"2015-09-15T16:15:58.514Z")
11
+ }
9
12
  describe "and the admin set code is found" do
10
13
  before {
11
- allow(described_class).to receive(:get).with(:find, code: "dvs") {
12
- {"id"=>1, "code"=>"dvs", "title"=>"Data and Visualization Services", "created_at"=>"2015-09-15T16:15:58.514Z", "updated_at"=>"2015-09-15T16:15:58.514Z"}
13
- }
14
+ allow(described_class).to receive(:find_by_code).with("dvs") { admin_set }
14
15
  }
15
16
  it "returns an AdminSet instance" do
16
- expect(described_class.call(obj)).to be_a(described_class)
17
+ expect(described_class.call(obj)).to eq(admin_set)
17
18
  end
18
19
  end
19
20
  describe "and the admin set is not found" do
20
21
  before {
21
- allow(described_class).to receive(:get).with(:find, code: "dvs")
22
+ allow(described_class).to receive(:find_by_code).with("dvs")
22
23
  .and_raise(ActiveResource::ResourceNotFound, "404")
23
24
  }
24
25
  it "raises an exception" do
@@ -7,13 +7,33 @@ RSpec.describe Collection, type: :model do
7
7
  it_behaves_like "it has an association", :has_many, :targets, :is_external_target_for, "Target"
8
8
  it_behaves_like "a publishable object"
9
9
 
10
+ describe "admin set" do
11
+ let(:admin_set) { Ddr::Models::AdminSet.new(code: "foobar", title: "FooBar") }
12
+ before do
13
+ allow(Ddr::Models::AdminSet).to receive(:find_by_code).with("foobar") { admin_set }
14
+ subject.admin_set = "foobar"
15
+ end
16
+ it "indexes the admin set title" do
17
+ expect(subject.to_solr[Ddr::Index::Fields::ADMIN_SET_TITLE]).to eq("FooBar")
18
+ end
19
+ end
20
+
21
+ describe "title" do
22
+ before do
23
+ subject.title = [ "Test Collection" ]
24
+ end
25
+ it "indexes the collection title" do
26
+ expect(subject.to_solr[Ddr::Index::Fields::COLLECTION_TITLE]).to eq("Test Collection")
27
+ end
28
+ end
29
+
10
30
  describe "legacy license information" do
11
31
  before do
12
32
  subject.defaultRights.license.title = ["License Title"]
13
33
  subject.defaultRights.license.description = ["License Description"]
14
34
  subject.defaultRights.license.url = ["http://library.duke.edu"]
15
35
  end
16
- it "should index the terms" do
36
+ it "indexes the terms" do
17
37
  expect(subject.to_solr[Ddr::Index::Fields::DEFAULT_LICENSE_TITLE]).to eq("License Title")
18
38
  expect(subject.to_solr[Ddr::Index::Fields::DEFAULT_LICENSE_DESCRIPTION]).to eq("License Description")
19
39
  expect(subject.to_solr[Ddr::Index::Fields::DEFAULT_LICENSE_URL]).to eq("http://library.duke.edu")
@@ -25,7 +45,7 @@ RSpec.describe Collection, type: :model do
25
45
  before do
26
46
  allow_any_instance_of(Component).to receive(:collection_uri).and_return(subject.internal_uri)
27
47
  end
28
- it "should return the correct component(s)" do
48
+ it "returns the correct component(s)" do
29
49
  component = Component.create
30
50
  docs = subject.components_from_solr
31
51
  expect(docs.size).to eq(1)
@@ -34,7 +54,7 @@ RSpec.describe Collection, type: :model do
34
54
  end
35
55
 
36
56
  describe "validation" do
37
- it "should require a title" do
57
+ it "requires a title" do
38
58
  expect(subject).to_not be_valid
39
59
  expect(subject.errors.messages).to have_key(:title)
40
60
  end
@@ -42,7 +62,7 @@ RSpec.describe Collection, type: :model do
42
62
 
43
63
  describe "creation" do
44
64
  subject { Collection.create(title: [ "Test Collection" ]) }
45
- it "should be governed by itself" do
65
+ it "is governed by itself" do
46
66
  expect(subject.admin_policy).to eq(subject)
47
67
  end
48
68
  end
@@ -50,7 +70,7 @@ RSpec.describe Collection, type: :model do
50
70
  describe "roles granted to creator" do
51
71
  let(:user) { FactoryGirl.build(:user) }
52
72
  before { subject.grant_roles_to_creator(user) }
53
- it "should include Curator roles in both resource abd policy scopes" do
73
+ it "includes Curator roles in both resource and policy scopes" do
54
74
  expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.build(type: "Curator", agent: user.agent, scope: "resource"), Ddr::Auth::Roles::Role.build(type: "Curator", agent: user.agent, scope: "policy")])
55
75
  end
56
76
  end
@@ -68,5 +68,18 @@ module Ddr
68
68
  expect(subject.display_type).to eq "Deletion"
69
69
  end
70
70
  end
71
+
72
+ RSpec.describe DeaccessionEvent, type: :model, events: true do
73
+ it_behaves_like "an event"
74
+ it_behaves_like "a preservation-related event"
75
+ it "should have a display type" do
76
+ expect(subject.display_type).to eq "Deaccession"
77
+ end
78
+
79
+ describe "permanent id" do
80
+ subject { described_class.new(pid: "test:1", permanent_id: "ark:/99999/fk4zzz") }
81
+ its(:permanent_id) { is_expected.to eq("ark:/99999/fk4zzz") }
82
+ end
83
+ end
71
84
  end
72
85
  end
@@ -73,6 +73,13 @@ module Ddr::Models
73
73
  .to("unavailable | deleted")
74
74
  end
75
75
  end
76
+ describe "object deaccession" do
77
+ it "marks the identifier as unavailable" do
78
+ expect { subject.deaccession }
79
+ .to change(identifier, :status)
80
+ .to("unavailable | deaccessioned")
81
+ end
82
+ end
76
83
  end
77
84
 
78
85
  describe "events" do
@@ -104,35 +111,57 @@ module Ddr::Models
104
111
 
105
112
  describe "workflow" do
106
113
 
107
- subject { FactoryGirl.build(:item) }
114
+ let(:collection) { FactoryGirl.create(:collection) }
115
+ let(:item) { FactoryGirl.create(:item) }
116
+ let(:component) { FactoryGirl.create(:component) }
117
+ before do
118
+ item.parent = collection
119
+ item.save!
120
+ component.parent = item
121
+ component.save!
122
+ end
108
123
 
109
124
  describe "#published?" do
110
125
  context "object is published" do
111
- before { allow(subject).to receive(:workflow_state) { Ddr::Managers::WorkflowManager::PUBLISHED } }
126
+ before { allow(collection).to receive(:workflow_state) { Ddr::Managers::WorkflowManager::PUBLISHED } }
112
127
  it "should return true" do
113
- expect(subject).to be_published
128
+ expect(collection).to be_published
114
129
  end
115
130
  end
116
131
  context "object is not published" do
117
- before { allow(subject).to receive(:workflow_state) { nil } }
132
+ before { allow(collection).to receive(:workflow_state) { nil } }
118
133
  it "should return false" do
119
- expect(subject).not_to be_published
134
+ expect(collection).not_to be_published
120
135
  end
121
136
  end
122
137
  end
123
138
 
124
139
  describe "#publish!" do
125
- it "should publish and persist the object" do
126
- subject.publish!
127
- expect(subject.reload).to be_published
140
+ context "do not include descendants" do
141
+ it "should publish and persist the object" do
142
+ collection.publish!(include_descendants: false)
143
+ expect(collection.reload).to be_published
144
+ expect(item.reload).not_to be_published
145
+ expect(component.reload).not_to be_published
146
+ end
147
+ end
148
+ context "do include descendants" do
149
+ it "should publish and persist the object and descendants" do
150
+ collection.publish!
151
+ expect(collection.reload).to be_published
152
+ expect(item.reload).to be_published
153
+ expect(component.reload).to be_published
154
+ end
128
155
  end
129
156
  end
130
157
 
131
158
  describe "#unpublish!" do
132
- before { subject.publish! }
133
- it "should unpublish and persist the object" do
134
- subject.unpublish!
135
- expect(subject.reload).not_to be_published
159
+ before { collection.publish! }
160
+ it "should unpublish and persist the object and descendants" do
161
+ collection.unpublish!
162
+ expect(collection.reload).not_to be_published
163
+ expect(item.reload).not_to be_published
164
+ expect(component.reload).not_to be_published
136
165
  end
137
166
  end
138
167
  end
@@ -12,32 +12,50 @@ module Ddr::Models
12
12
  let(:role4) { FactoryGirl.build(:role, :editor, :person, :policy) }
13
13
 
14
14
  before do
15
+ obj.adminMetadata.doi << "http://doi.org/10.1000/182"
16
+ obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
17
+ obj.display_format = "Image"
15
18
  obj.license = "cc-by-nc-nd-40"
16
- obj.rightsMetadata.license.title = ["License Title"]
17
- obj.rightsMetadata.license.description = ["License Description"]
18
- obj.rightsMetadata.license.url = ["http://library.duke.edu"]
19
19
  obj.local_id = "foo"
20
- obj.adminMetadata.doi << "http://doi.org/10.1000/182"
21
20
  obj.permanent_id = "ark:/99999/fk4zzz"
22
21
  obj.permanent_url = "http://id.library.duke.edu/ark:/99999/fk4zzz"
23
- obj.display_format = "Image"
22
+ obj.rightsMetadata.license.description = ["License Description"]
23
+ obj.rightsMetadata.license.title = ["License Title"]
24
+ obj.rightsMetadata.license.url = ["http://library.duke.edu"]
24
25
  obj.roles.grant role1, role2, role3, role4
25
- obj.aspace_id = "aspace_dccea43034e1b8261e14cf999e86449d"
26
+ obj.set_desc_metadata_values(:category, "Category Facet")
27
+ obj.set_desc_metadata_values(:company, "Company Facet")
28
+ obj.set_desc_metadata_values(:folder, "Folder Facet")
29
+ obj.set_desc_metadata_values(:medium, "Medium Facet")
30
+ obj.set_desc_metadata_values(:placement_company, "Placement Company Facet")
31
+ obj.set_desc_metadata_values(:product, "Product Facet")
32
+ obj.set_desc_metadata_values(:publication, "Publication Facet")
33
+ obj.set_desc_metadata_values(:setting, "Setting Facet")
34
+ obj.set_desc_metadata_values(:tone, "Tone Facet")
26
35
  end
27
36
 
37
+ its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
38
+ its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
39
+ its([Indexing::CATEGORY_FACET]) { is_expected.to eq(["Category Facet"]) }
40
+ its([Indexing::COMPANY_FACET]) { is_expected.to eq(["Company Facet"]) }
41
+ its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
42
+ its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
43
+ its([Indexing::FOLDER_FACET]) { is_expected.to eq(["Folder Facet"]) }
28
44
  its([Indexing::LICENSE]) { is_expected.to eq("cc-by-nc-nd-40") }
29
- its([Indexing::LICENSE_TITLE]) { is_expected.to eq("License Title") }
30
45
  its([Indexing::LICENSE_DESCRIPTION]) { is_expected.to eq("License Description") }
46
+ its([Indexing::LICENSE_TITLE]) { is_expected.to eq("License Title") }
31
47
  its([Indexing::LICENSE_URL]) { is_expected.to eq("http://library.duke.edu") }
32
48
  its([Indexing::LOCAL_ID]) { is_expected.to eq("foo") }
33
- its([Indexing::DOI]) { is_expected.to eq(["http://doi.org/10.1000/182"]) }
49
+ its([Indexing::MEDIUM_FACET]) { is_expected.to eq(["Medium Facet"]) }
34
50
  its([Indexing::PERMANENT_ID]) { is_expected.to eq("ark:/99999/fk4zzz") }
35
51
  its([Indexing::PERMANENT_URL]) { is_expected.to eq("http://id.library.duke.edu/ark:/99999/fk4zzz") }
36
- its([Indexing::DISPLAY_FORMAT]) { is_expected.to eq("Image") }
37
- its([Indexing::ACCESS_ROLE]) { is_expected.to eq(obj.roles.to_json) }
52
+ its([Indexing::PLACEMENT_COMPANY_FACET]) { is_expected.to eq(["Placement Company Facet"]) }
38
53
  its([Indexing::POLICY_ROLE]) { is_expected.to contain_exactly(role2.agent.first, role3.agent.first, role4.agent.first) }
54
+ its([Indexing::PRODUCT_FACET]) { is_expected.to eq(["Product Facet"]) }
55
+ its([Indexing::PUBLICATION_FACET]) { is_expected.to eq(["Publication Facet"]) }
39
56
  its([Indexing::RESOURCE_ROLE]) { is_expected.to contain_exactly(role1.agent.first) }
40
- its([Indexing::ASPACE_ID]) { is_expected.to eq("aspace_dccea43034e1b8261e14cf999e86449d") }
57
+ its([Indexing::SETTING_FACET]) { is_expected.to eq(["Setting Facet"]) }
58
+ its([Indexing::TONE_FACET]) { is_expected.to eq(["Tone Facet"]) }
41
59
  end
42
60
 
43
61
  describe "content-bearing object indexing" do
@@ -6,10 +6,43 @@ RSpec.shared_examples "a DDR model" do
6
6
  it_behaves_like "an object that has a display title"
7
7
  it_behaves_like "an object that has identifiers"
8
8
 
9
+ describe "notification on save" do
10
+ let(:events) { [] }
11
+ before {
12
+ @subscriber = ActiveSupport::Notifications.subscribe("save.#{described_class.to_s.underscore}") do |name, start, finish, id, payload|
13
+ events << payload
14
+ end
15
+ }
16
+ after {
17
+ ActiveSupport::Notifications.unsubscribe(@subscriber)
18
+ }
19
+ it "happens when save succeeds" do
20
+ subject.title = [ "My Title Changed" ]
21
+ subject.save
22
+ subject.title = [ "My Title Changed Again" ]
23
+ subject.save
24
+ expect(events.first[:changes]).to eq({"title"=>[[], ["My Title Changed"]]})
25
+ expect(events.first[:created]).to be true
26
+ expect(events.first[:pid]).to eq(subject.pid)
27
+ expect(events.last[:changes]).to eq({"title"=>[["My Title Changed"], ["My Title Changed Again"]]})
28
+ expect(events.last[:created]).to be false
29
+ expect(events.last[:pid]).to eq(subject.pid)
30
+ end
31
+ end
32
+
9
33
  describe "events" do
34
+ before {
35
+ subject.permanent_id = "ark:/99999/fk4zzz"
36
+ subject.save(validate: false)
37
+ allow(Ddr::Jobs::PermanentId::MakeUnavailable).to receive(:perform) { nil }
38
+ }
39
+ describe "deaccession" do
40
+ it "creates a deaccession event" do
41
+ expect { subject.deaccession }.to change { Ddr::Events::DeaccessionEvent.for_object(subject).count }.by(1)
42
+ end
43
+ end
10
44
  describe "on deletion with #destroy" do
11
- before { subject.save(validate: false) }
12
- it "should create a deletion event" do
45
+ it "creates a deletion event" do
13
46
  expect { subject.destroy }.to change { Ddr::Events::DeletionEvent.for_object(subject).count }.from(0).to(1)
14
47
  end
15
48
  end
@@ -38,7 +71,7 @@ RSpec.shared_examples "a DDR model" do
38
71
  context "one desc metadata identifier" do
39
72
  before { subject.identifier = Array(identifiers.first) }
40
73
  context "local id not present" do
41
- it "should set the local id and remove the identifier" do
74
+ it "sets the local id and removes the identifier" do
42
75
  result = subject.move_first_identifier_to_local_id
43
76
  expect(result).to be true
44
77
  expect(subject.local_id).to eq(identifiers.first)
@@ -48,7 +81,7 @@ RSpec.shared_examples "a DDR model" do
48
81
  context "local id present" do
49
82
  before { subject.local_id = local_id }
50
83
  context "replace option is true" do
51
- it "should set the local id and remove the identifier" do
84
+ it "sets the local id and removes the identifier" do
52
85
  result = subject.move_first_identifier_to_local_id
53
86
  expect(result).to be true
54
87
  expect(subject.local_id).to eq(identifiers.first)
@@ -58,7 +91,7 @@ RSpec.shared_examples "a DDR model" do
58
91
  context "replace option is false" do
59
92
  context "local id matches first identifier" do
60
93
  before { subject.identifier = Array(local_id) }
61
- it "should remove the identifier" do
94
+ it "removes the identifier" do
62
95
  result = subject.move_first_identifier_to_local_id(replace: false)
63
96
  expect(result).to be true
64
97
  expect(subject.local_id).to eq(local_id)
@@ -66,7 +99,7 @@ RSpec.shared_examples "a DDR model" do
66
99
  end
67
100
  end
68
101
  context "local id does not match first identifier" do
69
- it "should not change the local id and not remove the identifier" do
102
+ it "does not change the local id and does not remove the identifier" do
70
103
  result = subject.move_first_identifier_to_local_id(replace: false)
71
104
  expect(result).to be false
72
105
  expect(subject.local_id).to eq(local_id)
@@ -79,7 +112,7 @@ RSpec.shared_examples "a DDR model" do
79
112
  context "more than one desc metadata identifer" do
80
113
  before { subject.identifier = identifiers }
81
114
  context "local id not present" do
82
- it "should set the local id and remove the identifier" do
115
+ it "sets the local id and removes the identifier" do
83
116
  result = subject.move_first_identifier_to_local_id
84
117
  expect(result).to be true
85
118
  expect(subject.local_id).to eq(identifiers.first)
@@ -89,7 +122,7 @@ RSpec.shared_examples "a DDR model" do
89
122
  context "local id present" do
90
123
  before { subject.local_id = local_id }
91
124
  context "replace option is true" do
92
- it "should set the local id and remove the identifier" do
125
+ it "sets the local id and removes the identifier" do
93
126
  result = subject.move_first_identifier_to_local_id
94
127
  expect(result).to be true
95
128
  expect(subject.local_id).to eq(identifiers.first)
@@ -99,7 +132,7 @@ RSpec.shared_examples "a DDR model" do
99
132
  context "replace option is false" do
100
133
  context "local id matches first identifier" do
101
134
  before { subject.identifier = [ local_id, identifiers.last ] }
102
- it "should remove the identifier" do
135
+ it "removes the identifier" do
103
136
  result = subject.move_first_identifier_to_local_id(replace: false)
104
137
  expect(result).to be true
105
138
  expect(subject.local_id).to eq(local_id)
@@ -107,7 +140,7 @@ RSpec.shared_examples "a DDR model" do
107
140
  end
108
141
  end
109
142
  context "local id does not match first identifier" do
110
- it "should not change the local id and not remove the identifier" do
143
+ it "does not change the local id and does not remove the identifier" do
111
144
  result = subject.move_first_identifier_to_local_id(replace: false)
112
145
  expect(result).to be false
113
146
  expect(subject.local_id).to eq(local_id)
@@ -3,8 +3,34 @@ RSpec.shared_examples "a non-collection model" do
3
3
  subject { described_class.new }
4
4
  let(:user) { FactoryGirl.build(:user) }
5
5
  before { subject.grant_roles_to_creator(user) }
6
- it "should include the Editor role in resource scope" do
6
+ it "includes the Editor role in resource scope" do
7
7
  expect(subject.roles.to_a).to eq([Ddr::Auth::Roles::Role.build(type: "Editor", agent: user.agent, scope: "resource")])
8
8
  end
9
9
  end
10
+
11
+ describe "admin set" do
12
+ subject { described_class.new }
13
+ let(:collection) { FactoryGirl.build(:collection) }
14
+ let(:admin_set) { Ddr::Models::AdminSet.new(code: "foobar", title: "FooBar") }
15
+ before {
16
+ allow(Ddr::Models::AdminSet).to receive(:find_by_code).with("foobar") { admin_set }
17
+ collection.admin_set = "foobar"
18
+ collection.save!
19
+ subject.admin_policy = collection
20
+ }
21
+ it "indexes the admin set title" do
22
+ expect(subject.to_solr[Ddr::Index::Fields::ADMIN_SET_TITLE]).to eq("FooBar")
23
+ end
24
+ end
25
+
26
+ describe "collection title" do
27
+ subject { described_class.new }
28
+ let(:collection) { FactoryGirl.create(:collection) }
29
+ before {
30
+ subject.admin_policy = collection
31
+ }
32
+ it "indexes the collection title" do
33
+ expect(subject.to_solr[Ddr::Index::Fields::COLLECTION_TITLE]).to eq("Test Collection")
34
+ end
35
+ end
10
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.16
4
+ version: 2.5.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-26 00:00:00.000000000 Z
12
+ date: 2016-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -396,6 +396,7 @@ files:
396
396
  - db/migrate/20150130134416_add_user_key_to_events.rb
397
397
  - db/migrate/20150710211530_change_events_exception_to_text.rb
398
398
  - db/migrate/20150713171838_add_limit_to_events_exception.rb
399
+ - db/migrate/20161021201011_add_permanent_id_to_events.rb
399
400
  - ddr-models.gemspec
400
401
  - lib/ddr-models.rb
401
402
  - lib/ddr/actions.rb
@@ -468,6 +469,7 @@ files:
468
469
  - lib/ddr/derivatives/ptif_generator.rb
469
470
  - lib/ddr/events.rb
470
471
  - lib/ddr/events/creation_event.rb
472
+ - lib/ddr/events/deaccession_event.rb
471
473
  - lib/ddr/events/deletion_event.rb
472
474
  - lib/ddr/events/event.rb
473
475
  - lib/ddr/events/fixity_check_event.rb
@@ -721,9 +723,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
721
723
  version: '0'
722
724
  required_rubygems_version: !ruby/object:Gem::Requirement
723
725
  requirements:
724
- - - ">="
726
+ - - ">"
725
727
  - !ruby/object:Gem::Version
726
- version: '0'
728
+ version: 1.3.1
727
729
  requirements: []
728
730
  rubyforge_project:
729
731
  rubygems_version: 2.4.3