ddr-models 2.7.6 → 2.8.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/collection.rb +1 -1
- data/app/models/component.rb +22 -31
- data/config/initializers/active_fedora_base.rb +8 -0
- data/config/locales/ddr-models.en.yml +4 -0
- data/lib/ddr/datastreams.rb +12 -10
- data/lib/ddr/datastreams/administrative_metadata_datastream.rb +6 -0
- data/lib/ddr/datastreams/streamable_media_datastream.rb +5 -0
- data/lib/ddr/index/fields.rb +7 -5
- data/lib/ddr/managers/derivatives_manager.rb +12 -7
- data/lib/ddr/models.rb +19 -9
- data/lib/ddr/models/base.rb +10 -3
- data/lib/ddr/models/file_management.rb +1 -1
- data/lib/ddr/models/has_admin_metadata.rb +8 -9
- data/lib/ddr/models/indexing.rb +18 -3
- data/lib/ddr/models/language.rb +31 -0
- data/lib/ddr/models/media_type.rb +22 -0
- data/lib/ddr/models/{licenses/license.rb → rights_statement.rb} +3 -7
- data/lib/ddr/models/solr_document.rb +22 -2
- data/lib/ddr/models/streamable.rb +22 -0
- data/lib/ddr/models/version.rb +1 -1
- data/lib/ddr/utils.rb +4 -4
- data/lib/ddr/vocab/asset.rb +8 -0
- data/spec/factories/collection_factories.rb +1 -0
- data/spec/index/fields_spec.rb +18 -0
- data/spec/managers/derivatives_manager_spec.rb +2 -5
- data/spec/models/active_fedora_base_spec.rb +3 -0
- data/spec/models/admin_set_spec.rb +2 -1
- data/spec/models/attachment_spec.rb +1 -0
- data/spec/models/collection_spec.rb +4 -7
- data/spec/models/component_spec.rb +20 -5
- data/spec/models/has_struct_metadata_spec.rb +0 -1
- data/spec/models/indexing_spec.rb +91 -44
- data/spec/models/item_spec.rb +1 -0
- data/spec/models/language_spec.rb +59 -0
- data/spec/models/media_type_spec.rb +46 -0
- data/spec/models/{license_spec.rb → rights_statement_spec.rb} +9 -12
- data/spec/models/solr_document_spec.rb +57 -2
- data/spec/models/target_spec.rb +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/shared_examples_for_ddr_models.rb +12 -0
- data/spec/support/shared_examples_for_governables.rb +2 -1
- data/spec/support/shared_examples_for_streamable_media.rb +22 -0
- metadata +17 -13
- data/lib/ddr/models/licenses/admin_policy_license.rb +0 -11
- data/lib/ddr/models/licenses/effective_license.rb +0 -9
- data/lib/ddr/models/licenses/inherited_license.rb +0 -9
- data/lib/ddr/models/licenses/parent_license.rb +0 -11
- data/spec/models/effective_license_spec.rb +0 -74
@@ -1,74 +0,0 @@
|
|
1
|
-
module Ddr::Models
|
2
|
-
RSpec.describe EffectiveLicense do
|
3
|
-
|
4
|
-
subject { described_class.call(obj) }
|
5
|
-
|
6
|
-
let(:url) { "https://creativecommons.org/licenses/by-nc-nd/4.0/" }
|
7
|
-
|
8
|
-
let(:license) { License.new(url: url) }
|
9
|
-
|
10
|
-
let(:obj) { Component.new(pid: "test:1") }
|
11
|
-
let(:parent) { Item.new(pid: "test:2") }
|
12
|
-
let(:admin_policy) { Collection.new(pid: "test:3") }
|
13
|
-
|
14
|
-
describe "when the object has a license" do
|
15
|
-
before do
|
16
|
-
allow(License).to receive(:call).with(obj) { license }
|
17
|
-
end
|
18
|
-
it { is_expected.to eq(license) }
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "when the object does not have a license" do
|
22
|
-
before do
|
23
|
-
allow(License).to receive(:call).with(obj) { nil }
|
24
|
-
end
|
25
|
-
describe "and the object has a parent" do
|
26
|
-
before do
|
27
|
-
allow(obj).to receive(:parent) { parent }
|
28
|
-
end
|
29
|
-
describe "and the parent has a license" do
|
30
|
-
before do
|
31
|
-
allow(License).to receive(:call).with(parent) { license }
|
32
|
-
end
|
33
|
-
it { is_expected.to eq(license) }
|
34
|
-
end
|
35
|
-
describe "and the parent does not have a license" do
|
36
|
-
before do
|
37
|
-
allow(License).to receive(:call).with(parent) { nil }
|
38
|
-
end
|
39
|
-
it { is_expected.to be_nil }
|
40
|
-
end
|
41
|
-
end
|
42
|
-
describe "and the object does not have a parent" do
|
43
|
-
describe "and the object has an admin policy" do
|
44
|
-
before { allow(obj).to receive(:admin_policy) { admin_policy } }
|
45
|
-
describe "and the admin policy has a different id from the object" do
|
46
|
-
before do
|
47
|
-
allow(obj).to receive(:admin_policy_id) { "test:3" }
|
48
|
-
end
|
49
|
-
describe "and the admin policy has a license" do
|
50
|
-
before do
|
51
|
-
allow(License).to receive(:call).with(admin_policy) { license }
|
52
|
-
end
|
53
|
-
it { is_expected.to eq(license) }
|
54
|
-
end
|
55
|
-
describe "and the admin policy does not have a license" do
|
56
|
-
before do
|
57
|
-
allow(License).to receive(:call).with(admin_policy) { nil }
|
58
|
-
end
|
59
|
-
it { is_expected.to be_nil }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
describe "and the admin policy has the same id as the object" do
|
63
|
-
before { allow(obj).to receive(:admin_policy_id) { obj.id } }
|
64
|
-
it { is_expected.to be_nil }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
describe "and the object does not have an admin policy" do
|
68
|
-
it { is_expected.to be_nil }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|