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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/collection.rb +1 -1
  3. data/app/models/component.rb +22 -31
  4. data/config/initializers/active_fedora_base.rb +8 -0
  5. data/config/locales/ddr-models.en.yml +4 -0
  6. data/lib/ddr/datastreams.rb +12 -10
  7. data/lib/ddr/datastreams/administrative_metadata_datastream.rb +6 -0
  8. data/lib/ddr/datastreams/streamable_media_datastream.rb +5 -0
  9. data/lib/ddr/index/fields.rb +7 -5
  10. data/lib/ddr/managers/derivatives_manager.rb +12 -7
  11. data/lib/ddr/models.rb +19 -9
  12. data/lib/ddr/models/base.rb +10 -3
  13. data/lib/ddr/models/file_management.rb +1 -1
  14. data/lib/ddr/models/has_admin_metadata.rb +8 -9
  15. data/lib/ddr/models/indexing.rb +18 -3
  16. data/lib/ddr/models/language.rb +31 -0
  17. data/lib/ddr/models/media_type.rb +22 -0
  18. data/lib/ddr/models/{licenses/license.rb → rights_statement.rb} +3 -7
  19. data/lib/ddr/models/solr_document.rb +22 -2
  20. data/lib/ddr/models/streamable.rb +22 -0
  21. data/lib/ddr/models/version.rb +1 -1
  22. data/lib/ddr/utils.rb +4 -4
  23. data/lib/ddr/vocab/asset.rb +8 -0
  24. data/spec/factories/collection_factories.rb +1 -0
  25. data/spec/index/fields_spec.rb +18 -0
  26. data/spec/managers/derivatives_manager_spec.rb +2 -5
  27. data/spec/models/active_fedora_base_spec.rb +3 -0
  28. data/spec/models/admin_set_spec.rb +2 -1
  29. data/spec/models/attachment_spec.rb +1 -0
  30. data/spec/models/collection_spec.rb +4 -7
  31. data/spec/models/component_spec.rb +20 -5
  32. data/spec/models/has_struct_metadata_spec.rb +0 -1
  33. data/spec/models/indexing_spec.rb +91 -44
  34. data/spec/models/item_spec.rb +1 -0
  35. data/spec/models/language_spec.rb +59 -0
  36. data/spec/models/media_type_spec.rb +46 -0
  37. data/spec/models/{license_spec.rb → rights_statement_spec.rb} +9 -12
  38. data/spec/models/solr_document_spec.rb +57 -2
  39. data/spec/models/target_spec.rb +1 -0
  40. data/spec/spec_helper.rb +11 -0
  41. data/spec/support/shared_examples_for_ddr_models.rb +12 -0
  42. data/spec/support/shared_examples_for_governables.rb +2 -1
  43. data/spec/support/shared_examples_for_streamable_media.rb +22 -0
  44. metadata +17 -13
  45. data/lib/ddr/models/licenses/admin_policy_license.rb +0 -11
  46. data/lib/ddr/models/licenses/effective_license.rb +0 -9
  47. data/lib/ddr/models/licenses/inherited_license.rb +0 -9
  48. data/lib/ddr/models/licenses/parent_license.rb +0 -11
  49. data/spec/models/effective_license_spec.rb +0 -74
@@ -1,11 +0,0 @@
1
- module Ddr::Models
2
- class ParentLicense
3
-
4
- def self.call(obj)
5
- if obj.respond_to?(:parent) && obj.parent
6
- License.call(obj.parent)
7
- end
8
- end
9
-
10
- end
11
- end
@@ -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