ddr-models 1.16.2 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ddr/contacts.rb +25 -0
- data/lib/ddr/datastreams/administrative_metadata_datastream.rb +4 -0
- data/lib/ddr/index_fields.rb +2 -0
- data/lib/ddr/models.rb +1 -0
- data/lib/ddr/models/has_admin_metadata.rb +6 -0
- data/lib/ddr/models/indexing.rb +13 -11
- data/lib/ddr/models/solr_document.rb +18 -0
- data/lib/ddr/models/version.rb +1 -1
- data/lib/ddr/vocab.rb +2 -0
- data/lib/ddr/vocab/contact.rb +11 -0
- data/lib/ddr/vocab/display.rb +11 -0
- data/spec/contacts/contacts_spec.rb +26 -0
- data/spec/dummy/log/development.log +1698 -0
- data/spec/dummy/log/test.log +26260 -0
- data/spec/models/has_admin_metadata_spec.rb +20 -1
- data/spec/models/solr_document_spec.rb +39 -1
- metadata +7 -2
@@ -3,7 +3,7 @@ require 'support/ezid_mock_identifier'
|
|
3
3
|
|
4
4
|
module Ddr
|
5
5
|
module Models
|
6
|
-
RSpec.describe HasAdminMetadata, type: :model do
|
6
|
+
RSpec.describe HasAdminMetadata, type: :model, contacts: true do
|
7
7
|
|
8
8
|
describe "local id" do
|
9
9
|
subject { FactoryGirl.build(:item) }
|
@@ -121,9 +121,11 @@ module Ddr
|
|
121
121
|
describe "indexing" do
|
122
122
|
let(:permanent_id) { "ark:/99999/fk4zzz" }
|
123
123
|
let(:permanent_url) { "http://id.library.duke.edu/ark:/99999/fk4zzz" }
|
124
|
+
let(:display_format) { "Image" }
|
124
125
|
before do
|
125
126
|
subject.permanent_id = permanent_id
|
126
127
|
subject.permanent_url = permanent_url
|
128
|
+
subject.display_format = display_format
|
127
129
|
end
|
128
130
|
it "should index the permanent id value" do
|
129
131
|
expect(subject.to_solr[Ddr::IndexFields::PERMANENT_ID]).to eq(permanent_id)
|
@@ -131,6 +133,9 @@ module Ddr
|
|
131
133
|
it "should index the permanent url" do
|
132
134
|
expect(subject.to_solr[Ddr::IndexFields::PERMANENT_URL]).to eq(permanent_url)
|
133
135
|
end
|
136
|
+
it "should index the display format" do
|
137
|
+
expect(subject.to_solr[Ddr::IndexFields::DISPLAY_FORMAT]).to eq(display_format)
|
138
|
+
end
|
134
139
|
end
|
135
140
|
|
136
141
|
end
|
@@ -213,6 +218,20 @@ module Ddr
|
|
213
218
|
end
|
214
219
|
end
|
215
220
|
|
221
|
+
describe "contacts" do
|
222
|
+
before do
|
223
|
+
allow(YAML).to receive(:load_file) { { 'a' => { 'name' => 'Contact A', 'short_name' => 'A' },
|
224
|
+
'b' => { 'name' => 'Contact B', 'short_name' => 'B' } } }
|
225
|
+
Ddr::Contacts.load_contacts
|
226
|
+
end
|
227
|
+
describe "#research_help" do
|
228
|
+
before { subject.research_help_contact = 'b' }
|
229
|
+
it "should return the appropriate contact" do
|
230
|
+
expect(subject.research_help.slug).to eq('b')
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
216
235
|
end
|
217
236
|
end
|
218
237
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe SolrDocument, type: :model do
|
3
|
+
RSpec.describe SolrDocument, type: :model, contacts: true do
|
4
4
|
|
5
5
|
describe "#inherited_license" do
|
6
6
|
let(:apo_solr_response) { [{"system_create_dtsi"=>"2015-03-10T15:20:16Z", "system_modified_dtsi"=>"2015-03-10T15:21:50Z", "object_state_ssi"=>"A", "active_fedora_model_ssi"=>"Collection", "id"=>"changeme:224", "object_profile_ssm"=>["{\"datastreams\":{\"DC\":{\"dsLabel\":\"Dublin Core Record for this object\",\"dsVersionID\":\"DC1.0\",\"dsCreateDate\":\"2015-03-10T15:20:16Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":\"http://www.openarchives.org/OAI/2.0/oai_dc/\",\"dsControlGroup\":\"X\",\"dsSize\":341,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+DC+DC1.0\",\"dsLocationType\":null,\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"0555f020bbfc94c07745f530af4195fed9cf4e4ba539a30727f2d2d5743627be\"},\"RELS-EXT\":{\"dsLabel\":\"Fedora Object-to-Object Relationship Metadata\",\"dsVersionID\":\"RELS-EXT.1\",\"dsCreateDate\":\"2015-03-10T15:20:18Z\",\"dsState\":\"A\",\"dsMIME\":\"application/rdf+xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"X\",\"dsSize\":417,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+RELS-EXT+RELS-EXT.1\",\"dsLocationType\":null,\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"6a7c2621534cd1cb28d9cfa7e45bb128a1f3c05028e29def4dea479be9596d7d\"},\"descMetadata\":{\"dsLabel\":\"Descriptive Metadata for this object\",\"dsVersionID\":\"descMetadata.1\",\"dsCreateDate\":\"2015-03-10T15:20:18Z\",\"dsState\":\"A\",\"dsMIME\":\"application/n-triples\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":80,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+descMetadata+descMetadata.1\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"bbba526a1ca47f19dfe110f25a0a721bda481dc414f7ec89e3f02c5562eaa9a2\"},\"rightsMetadata\":{\"dsLabel\":null,\"dsVersionID\":\"rightsMetadata.0\",\"dsCreateDate\":\"2015-03-10T15:20:17Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":550,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+rightsMetadata+rightsMetadata.0\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"210d5a228bd96e22b20723de1dd20ea8d897252063713d0815369c49045c5c05\"},\"properties\":{},\"thumbnail\":{},\"adminMetadata\":{},\"defaultRights\":{\"dsLabel\":null,\"dsVersionID\":\"defaultRights.0\",\"dsCreateDate\":\"2015-03-10T15:21:50Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":634,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+defaultRights+defaultRights.0\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"1a2d9e665228d5e3cbf5f8ddd0d641172c20f98b4e05d62f741b7b9010696ad0\"}},\"objLabel\":null,\"objOwnerId\":\"fedoraAdmin\",\"objModels\":[\"info:fedora/afmodel:Collection\",\"info:fedora/fedora-system:FedoraObject-3.0\"],\"objCreateDate\":\"2015-03-10T15:20:16Z\",\"objLastModDate\":\"2015-03-10T15:20:18Z\",\"objDissIndexViewURL\":\"http://localhost:8983/fedora/objects/changeme%3A224/methods/fedora-system%3A3/viewMethodIndex\",\"objItemIndexViewURL\":\"http://localhost:8983/fedora/objects/changeme%3A224/methods/fedora-system%3A3/viewItemIndex\",\"objState\":\"A\"}"], "title_tesim"=>["Test Collection"], "edit_access_person_ssim"=>["coblej@duke.edu"], "inheritable_read_access_group_ssim"=>["public"], "is_governed_by_ssim"=>["info:fedora/changeme:224"], "has_model_ssim"=>["info:fedora/afmodel:Collection"], "title_ssi"=>"Test Collection", "internal_uri_ssi"=>"info:fedora/changeme:224", "default_license_description_tesim"=>["Default License Description"], "default_license_title_tesim"=>["Default License Title"], "default_license_url_tesim"=>["http://test.license.org/"], "_version_"=>1495270331036729344, "timestamp"=>"2015-03-10T15:21:50.793Z"}] }
|
@@ -85,4 +85,42 @@ RSpec.describe SolrDocument, type: :model do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
describe "#display_format" do
|
89
|
+
before { subject[Ddr::IndexFields::DISPLAY_FORMAT] = "Image" }
|
90
|
+
its(:display_format) { should eq("Image") }
|
91
|
+
end
|
92
|
+
|
93
|
+
describe "contacts" do
|
94
|
+
before do
|
95
|
+
allow(YAML).to receive(:load_file) { { 'a' => { 'name' => 'Contact A', 'short_name' => 'A' },
|
96
|
+
'b' => { 'name' => 'Contact B', 'short_name' => 'B' } } }
|
97
|
+
Ddr::Contacts.load_contacts
|
98
|
+
end
|
99
|
+
describe "#research_help" do
|
100
|
+
context "object has research help contact" do
|
101
|
+
before { subject[Ddr::IndexFields::RESEARCH_HELP_CONTACT] = 'b' }
|
102
|
+
it "should return the object's research help contact" do
|
103
|
+
expect(subject.research_help.slug).to eq('b')
|
104
|
+
end
|
105
|
+
end
|
106
|
+
context "object does not have research help contact" do
|
107
|
+
context "collection has research help contact" do
|
108
|
+
let(:apo_solr_response) { [{"system_create_dtsi"=>"2015-03-10T15:20:16Z", "system_modified_dtsi"=>"2015-03-10T15:21:50Z", "object_state_ssi"=>"A", "active_fedora_model_ssi"=>"Collection", "id"=>"changeme:224", "object_profile_ssm"=>["{\"datastreams\":{\"DC\":{\"dsLabel\":\"Dublin Core Record for this object\",\"dsVersionID\":\"DC1.0\",\"dsCreateDate\":\"2015-03-10T15:20:16Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":\"http://www.openarchives.org/OAI/2.0/oai_dc/\",\"dsControlGroup\":\"X\",\"dsSize\":341,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+DC+DC1.0\",\"dsLocationType\":null,\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"0555f020bbfc94c07745f530af4195fed9cf4e4ba539a30727f2d2d5743627be\"},\"RELS-EXT\":{\"dsLabel\":\"Fedora Object-to-Object Relationship Metadata\",\"dsVersionID\":\"RELS-EXT.1\",\"dsCreateDate\":\"2015-03-10T15:20:18Z\",\"dsState\":\"A\",\"dsMIME\":\"application/rdf+xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"X\",\"dsSize\":417,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+RELS-EXT+RELS-EXT.1\",\"dsLocationType\":null,\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"6a7c2621534cd1cb28d9cfa7e45bb128a1f3c05028e29def4dea479be9596d7d\"},\"descMetadata\":{\"dsLabel\":\"Descriptive Metadata for this object\",\"dsVersionID\":\"descMetadata.1\",\"dsCreateDate\":\"2015-03-10T15:20:18Z\",\"dsState\":\"A\",\"dsMIME\":\"application/n-triples\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":80,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+descMetadata+descMetadata.1\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"bbba526a1ca47f19dfe110f25a0a721bda481dc414f7ec89e3f02c5562eaa9a2\"},\"rightsMetadata\":{\"dsLabel\":null,\"dsVersionID\":\"rightsMetadata.0\",\"dsCreateDate\":\"2015-03-10T15:20:17Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":550,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+rightsMetadata+rightsMetadata.0\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"210d5a228bd96e22b20723de1dd20ea8d897252063713d0815369c49045c5c05\"},\"properties\":{},\"thumbnail\":{},\"adminMetadata\":{},\"defaultRights\":{\"dsLabel\":null,\"dsVersionID\":\"defaultRights.0\",\"dsCreateDate\":\"2015-03-10T15:21:50Z\",\"dsState\":\"A\",\"dsMIME\":\"text/xml\",\"dsFormatURI\":null,\"dsControlGroup\":\"M\",\"dsSize\":634,\"dsVersionable\":true,\"dsInfoType\":null,\"dsLocation\":\"changeme:224+defaultRights+defaultRights.0\",\"dsLocationType\":\"INTERNAL_ID\",\"dsChecksumType\":\"SHA-256\",\"dsChecksum\":\"1a2d9e665228d5e3cbf5f8ddd0d641172c20f98b4e05d62f741b7b9010696ad0\"}},\"objLabel\":null,\"objOwnerId\":\"fedoraAdmin\",\"objModels\":[\"info:fedora/afmodel:Collection\",\"info:fedora/fedora-system:FedoraObject-3.0\"],\"objCreateDate\":\"2015-03-10T15:20:16Z\",\"objLastModDate\":\"2015-03-10T15:20:18Z\",\"objDissIndexViewURL\":\"http://localhost:8983/fedora/objects/changeme%3A224/methods/fedora-system%3A3/viewMethodIndex\",\"objItemIndexViewURL\":\"http://localhost:8983/fedora/objects/changeme%3A224/methods/fedora-system%3A3/viewItemIndex\",\"objState\":\"A\"}"], "title_tesim"=>["Test Collection"], "edit_access_person_ssim"=>["coblej@duke.edu"], "inheritable_read_access_group_ssim"=>["public"], "is_governed_by_ssim"=>["info:fedora/changeme:224"], "has_model_ssim"=>["info:fedora/afmodel:Collection"], "title_ssi"=>"Test Collection", "internal_uri_ssi"=>"info:fedora/changeme:224", Ddr::IndexFields::RESEARCH_HELP_CONTACT=>["a"], "_version_"=>1495270331036729344, "timestamp"=>"2015-03-10T15:21:50.793Z"}] }
|
109
|
+
before do
|
110
|
+
allow(subject).to receive(:admin_policy_pid).and_return('changeme:224')
|
111
|
+
allow(ActiveFedora::SolrService).to receive(:query).and_return(apo_solr_response)
|
112
|
+
end
|
113
|
+
it "should return the collection's research help contact" do
|
114
|
+
expect(subject.research_help.slug).to eq("a")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
context "collection does not have research help contact" do
|
118
|
+
it "should return nil" do
|
119
|
+
expect(subject.research_help).to be_nil
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
88
126
|
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: 1.
|
4
|
+
version: 1.17.0
|
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: 2015-07-
|
12
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -355,6 +355,7 @@ files:
|
|
355
355
|
- lib/ddr/auth/superuser.rb
|
356
356
|
- lib/ddr/auth/test_helpers.rb
|
357
357
|
- lib/ddr/auth/user.rb
|
358
|
+
- lib/ddr/contacts.rb
|
358
359
|
- lib/ddr/datastreams.rb
|
359
360
|
- lib/ddr/datastreams/administrative_metadata_datastream.rb
|
360
361
|
- lib/ddr/datastreams/datastream_behavior.rb
|
@@ -417,6 +418,8 @@ files:
|
|
417
418
|
- lib/ddr/utils.rb
|
418
419
|
- lib/ddr/vocab.rb
|
419
420
|
- lib/ddr/vocab/asset.rb
|
421
|
+
- lib/ddr/vocab/contact.rb
|
422
|
+
- lib/ddr/vocab/display.rb
|
420
423
|
- lib/ddr/vocab/duke_terms.rb
|
421
424
|
- lib/ddr/vocab/rdf_vocabulary_parser.rb
|
422
425
|
- lib/ddr/vocab/roles.rb
|
@@ -433,6 +436,7 @@ files:
|
|
433
436
|
- spec/auth/roles/role_spec.rb
|
434
437
|
- spec/auth/roles/role_type_spec.rb
|
435
438
|
- spec/auth/user_spec.rb
|
439
|
+
- spec/contacts/contacts_spec.rb
|
436
440
|
- spec/controllers/application_controller_spec.rb
|
437
441
|
- spec/controllers/including_role_based_access_controls_enforcement_spec.rb
|
438
442
|
- spec/controllers/users/sessions_controller_spec.rb
|
@@ -562,6 +566,7 @@ test_files:
|
|
562
566
|
- spec/auth/roles/role_spec.rb
|
563
567
|
- spec/auth/roles/role_type_spec.rb
|
564
568
|
- spec/auth/user_spec.rb
|
569
|
+
- spec/contacts/contacts_spec.rb
|
565
570
|
- spec/controllers/application_controller_spec.rb
|
566
571
|
- spec/controllers/including_role_based_access_controls_enforcement_spec.rb
|
567
572
|
- spec/controllers/users/sessions_controller_spec.rb
|