active-fedora 13.1.2 → 13.2.4

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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/.github_changelog_generator +2 -0
  3. data/CHANGELOG.md +3362 -0
  4. data/CONTRIBUTING.md +23 -1
  5. data/README.md +4 -0
  6. data/active-fedora.gemspec +13 -13
  7. data/config/fedora.yml +5 -5
  8. data/lib/active_fedora/core.rb +3 -0
  9. data/lib/active_fedora/indexing/descendant_fetcher.rb +7 -11
  10. data/lib/active_fedora/ldp_resource.rb +6 -0
  11. data/lib/active_fedora/orders/ordered_list.rb +2 -2
  12. data/lib/active_fedora/version.rb +3 -1
  13. data/lib/active_fedora/with_metadata/default_schema.rb +12 -1
  14. data/lib/generators/active_fedora/config/fedora/templates/fedora.yml +6 -6
  15. data/lib/generators/active_fedora/config/solr/templates/solr/conf/schema.xml +3 -3
  16. metadata +98 -214
  17. data/spec/config_helper.rb +0 -17
  18. data/spec/fixtures/dino.jpg +0 -0
  19. data/spec/fixtures/dino_jpg_no_file_ext +0 -0
  20. data/spec/fixtures/minivan.jpg +0 -0
  21. data/spec/fixtures/rails_root/config/fake_fedora.yml +0 -7
  22. data/spec/fixtures/rails_root/config/fedora.yml +0 -12
  23. data/spec/fixtures/rails_root/config/solr.yml +0 -15
  24. data/spec/fixtures/rails_root/config/solr_mappings.yml +0 -16
  25. data/spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml +0 -9
  26. data/spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml +0 -17
  27. data/spec/integration/associations/rdf_spec.rb +0 -61
  28. data/spec/integration/associations_spec.rb +0 -680
  29. data/spec/integration/attached_files_spec.rb +0 -146
  30. data/spec/integration/attributes_spec.rb +0 -73
  31. data/spec/integration/autosave_association_spec.rb +0 -24
  32. data/spec/integration/base_spec.rb +0 -184
  33. data/spec/integration/basic_contains_association_spec.rb +0 -121
  34. data/spec/integration/belongs_to_association_spec.rb +0 -260
  35. data/spec/integration/caching_spec.rb +0 -59
  36. data/spec/integration/clean_connection_spec.rb +0 -21
  37. data/spec/integration/collection_association_spec.rb +0 -166
  38. data/spec/integration/date_time_properties_spec.rb +0 -41
  39. data/spec/integration/delete_all_spec.rb +0 -64
  40. data/spec/integration/direct_container_spec.rb +0 -250
  41. data/spec/integration/directly_contains_one_association_spec.rb +0 -96
  42. data/spec/integration/eradicate_spec.rb +0 -52
  43. data/spec/integration/fedora_solr_sync_spec.rb +0 -30
  44. data/spec/integration/file_fixity_spec.rb +0 -36
  45. data/spec/integration/file_spec.rb +0 -221
  46. data/spec/integration/generators/fedora_generator_spec.rb +0 -26
  47. data/spec/integration/generators/solr_generator_spec.rb +0 -23
  48. data/spec/integration/gone_spec.rb +0 -41
  49. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +0 -414
  50. data/spec/integration/has_many_associations_spec.rb +0 -436
  51. data/spec/integration/has_subresource_spec.rb +0 -34
  52. data/spec/integration/indexing/descendant_fetcher_spec.rb +0 -64
  53. data/spec/integration/indexing_spec.rb +0 -110
  54. data/spec/integration/indirect_container_spec.rb +0 -290
  55. data/spec/integration/json_serialization_spec.rb +0 -32
  56. data/spec/integration/marshal_spec.rb +0 -39
  57. data/spec/integration/nested_attribute_spec.rb +0 -177
  58. data/spec/integration/nested_hash_resources_spec.rb +0 -43
  59. data/spec/integration/persistence_spec.rb +0 -37
  60. data/spec/integration/query_result_builder_spec.rb +0 -37
  61. data/spec/integration/rdf_nested_attributes_spec.rb +0 -85
  62. data/spec/integration/relation_delegation_spec.rb +0 -52
  63. data/spec/integration/relation_spec.rb +0 -117
  64. data/spec/integration/scoped_query_spec.rb +0 -134
  65. data/spec/integration/scoping_spec.rb +0 -48
  66. data/spec/integration/solr_hit_spec.rb +0 -32
  67. data/spec/integration/versionable_spec.rb +0 -256
  68. data/spec/integration/with_metadata_spec.rb +0 -111
  69. data/spec/lib/active_fedora/null_logger_spec.rb +0 -10
  70. data/spec/rcov.opts +0 -2
  71. data/spec/spec.opts +0 -5
  72. data/spec/spec_helper.rb +0 -106
  73. data/spec/support/an_active_model.rb +0 -29
  74. data/spec/unit/active_fedora/indexing/inserter_spec.rb +0 -35
  75. data/spec/unit/active_fedora_spec.rb +0 -118
  76. data/spec/unit/aggregation/list_source_spec.rb +0 -134
  77. data/spec/unit/aggregation/ordered_reader_spec.rb +0 -43
  78. data/spec/unit/association_hash_spec.rb +0 -64
  79. data/spec/unit/attached_files_spec.rb +0 -218
  80. data/spec/unit/attributes_spec.rb +0 -146
  81. data/spec/unit/base_active_model_spec.rb +0 -28
  82. data/spec/unit/base_cma_spec.rb +0 -15
  83. data/spec/unit/base_extra_spec.rb +0 -33
  84. data/spec/unit/base_spec.rb +0 -328
  85. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +0 -8
  86. data/spec/unit/callback_spec.rb +0 -65
  87. data/spec/unit/change_set_spec.rb +0 -60
  88. data/spec/unit/checksum_spec.rb +0 -25
  89. data/spec/unit/code_configurator_spec.rb +0 -41
  90. data/spec/unit/collection_proxy_spec.rb +0 -25
  91. data/spec/unit/config_spec.rb +0 -18
  92. data/spec/unit/core/fedora_id_translator_spec.rb +0 -29
  93. data/spec/unit/core/fedora_uri_translator_spec.rb +0 -19
  94. data/spec/unit/core/logger_spec.rb +0 -18
  95. data/spec/unit/core_spec.rb +0 -242
  96. data/spec/unit/default_model_mapper_spec.rb +0 -39
  97. data/spec/unit/fedora_spec.rb +0 -31
  98. data/spec/unit/file/streaming_spec.rb +0 -33
  99. data/spec/unit/file_configurator_spec.rb +0 -295
  100. data/spec/unit/file_io_spec.rb +0 -137
  101. data/spec/unit/file_path_builder_spec.rb +0 -18
  102. data/spec/unit/file_spec.rb +0 -489
  103. data/spec/unit/files_hash_spec.rb +0 -52
  104. data/spec/unit/filter_spec.rb +0 -133
  105. data/spec/unit/finder_methods_spec.rb +0 -154
  106. data/spec/unit/fixity_service_spec.rb +0 -128
  107. data/spec/unit/forbidden_attributes_protection_spec.rb +0 -50
  108. data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -125
  109. data/spec/unit/has_many_association_spec.rb +0 -131
  110. data/spec/unit/indexers/global_indexer_spec.rb +0 -41
  111. data/spec/unit/indexing/map/index_object_spec.rb +0 -25
  112. data/spec/unit/indexing/map_spec.rb +0 -27
  113. data/spec/unit/indexing_service_spec.rb +0 -28
  114. data/spec/unit/indexing_spec.rb +0 -86
  115. data/spec/unit/inheritance_spec.rb +0 -60
  116. data/spec/unit/ldp_resource_spec.rb +0 -15
  117. data/spec/unit/loadable_from_json_spec.rb +0 -40
  118. data/spec/unit/logger_spec.rb +0 -19
  119. data/spec/unit/model_classifier_spec.rb +0 -49
  120. data/spec/unit/ordered_spec.rb +0 -367
  121. data/spec/unit/orders/list_node_spec.rb +0 -151
  122. data/spec/unit/orders/ordered_list_spec.rb +0 -335
  123. data/spec/unit/orders/reflection_spec.rb +0 -22
  124. data/spec/unit/pathing_spec.rb +0 -35
  125. data/spec/unit/persistence_spec.rb +0 -115
  126. data/spec/unit/property_predicate_spec.rb +0 -35
  127. data/spec/unit/property_spec.rb +0 -25
  128. data/spec/unit/query_result_builder_spec.rb +0 -31
  129. data/spec/unit/query_spec.rb +0 -307
  130. data/spec/unit/querying_spec.rb +0 -24
  131. data/spec/unit/rdf/indexing_service_spec.rb +0 -114
  132. data/spec/unit/rdf_vocab_spec.rb +0 -30
  133. data/spec/unit/readonly_spec.rb +0 -24
  134. data/spec/unit/reflection_spec.rb +0 -42
  135. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +0 -37
  136. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +0 -38
  137. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +0 -38
  138. data/spec/unit/schema_indexing_strategy_spec.rb +0 -68
  139. data/spec/unit/scoping_spec.rb +0 -67
  140. data/spec/unit/serializers_spec.rb +0 -19
  141. data/spec/unit/solr_config_options_spec.rb +0 -57
  142. data/spec/unit/solr_hit_spec.rb +0 -57
  143. data/spec/unit/solr_query_builder_spec.rb +0 -18
  144. data/spec/unit/solr_service_spec.rb +0 -165
  145. data/spec/unit/sparql_insert_spec.rb +0 -31
  146. data/spec/unit/validations_spec.rb +0 -92
  147. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +0 -29
  148. data/spec/unit/with_metadata/metadata_node_spec.rb +0 -69
@@ -1,43 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe ActiveFedora::Aggregation::OrderedReader do
4
- subject(:ordered_reader) { described_class.new(root) }
5
- let(:root) { instance_double(ActiveFedora::Aggregation::ListSource) }
6
-
7
- describe "#each" do
8
- it "iterates a linked list" do
9
- head = build_node
10
- tail = build_node(prev_node: head)
11
- allow(head).to receive(:next).and_return(tail)
12
- allow(root).to receive(:head).and_return(head)
13
- expect(ordered_reader.to_a).to eq [head, tail]
14
- end
15
- it "only goes as deep as necessary" do
16
- head = build_node
17
- tail = build_node(prev_node: head)
18
- allow(head).to receive(:next).and_return(tail)
19
- allow(root).to receive(:head).and_return(head)
20
- expect(ordered_reader.first).to eq head
21
- expect(head).not_to have_received(:next)
22
- end
23
- context "when the prev is wrong" do
24
- it "fixes it up" do
25
- head = build_node
26
- bad_node = build_node
27
- tail = build_node(prev_node: bad_node)
28
- allow(head).to receive(:next).and_return(tail)
29
- allow(root).to receive(:head).and_return(head)
30
- allow(tail).to receive(:prev=)
31
- expect(ordered_reader.to_a).to eq [head, tail]
32
- expect(tail).to have_received(:prev=).with(head)
33
- end
34
- end
35
- end
36
-
37
- def build_node(prev_node: nil, next_node: nil)
38
- node = instance_double(ActiveFedora::Orders::ListNode)
39
- allow(node).to receive(:next).and_return(next_node)
40
- allow(node).to receive(:prev).and_return(prev_node)
41
- node
42
- end
43
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveFedora::AssociationHash do
4
- subject(:association_hash) { described_class.new(model, reflections) }
5
-
6
- let(:model) { instance_double(ActiveFedora::Base, association: nil) }
7
- let(:reflections) { { foo: association } }
8
- let(:reader) { double("reader") }
9
- let(:writer) { double("writer") }
10
- let(:association) { double(reader: reader, writer: writer) }
11
-
12
- before do
13
- allow(model).to receive(:association).with(:foo).and_return(association)
14
- end
15
-
16
- describe "key reader" do
17
- describe "when the association exists" do
18
- it "calls the association reader" do
19
- expect(association_hash["foo"]).to eq(reader)
20
- end
21
- end
22
- describe "when the association does not exist" do
23
- it "returns nil" do
24
- expect(association_hash["bar"]).to be_nil
25
- end
26
- end
27
- end
28
-
29
- describe "key setter" do
30
- let(:obj) { double }
31
- describe "when the association exists" do
32
- it "calls the association writer" do
33
- expect(association).to receive(:writer).with(obj)
34
- association_hash["foo"] = obj
35
- end
36
- end
37
- describe "when the association does not exist" do
38
- it "doesn't call the association writer" do
39
- expect(association).not_to receive(:writer).with(obj)
40
- association_hash["bar"] = obj
41
- end
42
- end
43
- end
44
-
45
- describe "#association" do
46
- it "works with a string key" do
47
- expect(association_hash.association("foo")).to eq(association)
48
- end
49
- it "works with a symbol key" do
50
- expect(association_hash.association(:foo)).to eq(association)
51
- end
52
- end
53
-
54
- describe "#key?" do
55
- it "works with a string" do
56
- expect(association_hash.key?("foo")).to be true
57
- expect(association_hash.key?("bar")).to be false
58
- end
59
- it "works with a symbol" do
60
- expect(association_hash.key?(:foo)).to be true
61
- expect(association_hash.key?(:bar)).to be false
62
- end
63
- end
64
- end
@@ -1,218 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveFedora::AttachedFiles do
4
- subject(:af_base) { ActiveFedora::Base.new }
5
- describe "has_subresource" do
6
- before do
7
- class Sample1 < ActiveFedora::File
8
- end
9
- class Sample2 < ActiveFedora::File
10
- end
11
- class FooHistory < ActiveFedora::Base
12
- has_subresource 'dsid', class_name: 'Sample2'
13
- has_subresource 'complex_ds', autocreate: true, class_name: 'Sample1'
14
- has_subresource 'thumbnail'
15
- has_subresource 'child_resource', class_name: 'ActiveFedora::Base'
16
- end
17
- end
18
- after do
19
- Object.send(:remove_const, :Sample1)
20
- Object.send(:remove_const, :Sample2)
21
- Object.send(:remove_const, :FooHistory)
22
- end
23
-
24
- it "has a child_resource_reflection" do
25
- expect(FooHistory.child_resource_reflections).to have_key(:dsid)
26
- expect(FooHistory.child_resource_reflections).to have_key(:thumbnail)
27
- expect(FooHistory.child_resource_reflections).not_to have_key(:child_resource)
28
- end
29
-
30
- it "lets you override defaults" do
31
- expect(FooHistory.child_resource_reflections[:complex_ds].options).to include(autocreate: true)
32
- expect(FooHistory.child_resource_reflections[:complex_ds].class_name).to eq 'Sample1'
33
- end
34
-
35
- it "raises an error if you don't give a dsid" do
36
- expect { FooHistory.has_subresource nil, type: Sample2 }.to raise_error ArgumentError,
37
- "You must provide a path name (f.k.a. dsid) for the resource"
38
- end
39
- end
40
-
41
- describe "#add_file" do
42
- before do
43
- class Bar < ActiveFedora::File; end
44
-
45
- class FooHistory < ActiveFedora::Base
46
- has_subresource :content, class_name: 'Bar'
47
- end
48
- end
49
-
50
- after do
51
- Object.send(:remove_const, :Bar)
52
- Object.send(:remove_const, :FooHistory)
53
- end
54
- let(:container) { FooHistory.new }
55
-
56
- context "a reflection matches the :path property" do
57
- it "builds the reflection" do
58
- container.add_file('blah', path: 'content')
59
- expect(container.content).to be_instance_of Bar
60
- expect(container.content.content).to eq 'blah'
61
- end
62
- end
63
-
64
- context "no reflection matches the :path property" do
65
- it "creates a singleton reflection and build it" do
66
- container.add_file('blah', path: 'fizz')
67
- expect(container.fizz).to be_instance_of ActiveFedora::File
68
- expect(container.fizz.content).to eq 'blah'
69
- end
70
- end
71
- end
72
-
73
- describe "#declared_attached_files" do
74
- subject { obj.declared_attached_files }
75
-
76
- context "when there are undeclared attached files" do
77
- let(:obj) { ActiveFedora::Base.create }
78
- let(:file) { ActiveFedora::File.new }
79
- before do
80
- obj.attach_file(file, 'Abc')
81
- end
82
- it { is_expected.to be_empty }
83
- end
84
-
85
- context "when there are declared attached files" do
86
- before do
87
- class FooHistory < ActiveFedora::Base
88
- has_subresource 'thumbnail'
89
- end
90
- end
91
-
92
- after do
93
- Object.send(:remove_const, :FooHistory)
94
- end
95
- let(:obj) { FooHistory.new }
96
- it { is_expected.to have_key :thumbnail }
97
- end
98
- end
99
-
100
- describe "#serialize_attached_files" do
101
- it "touches each file" do
102
- m1 = instance_double(ActiveFedora::File)
103
- m2 = instance_double(ActiveFedora::File)
104
-
105
- expect(m1).to receive(:serialize!)
106
- expect(m2).to receive(:serialize!)
107
- allow(af_base).to receive(:declared_attached_files).and_return(m1: m1, m2: m2)
108
- af_base.serialize_attached_files
109
- end
110
- end
111
-
112
- describe "#accessor_name" do
113
- subject { af_base.send(:accessor_name, value) }
114
- context "with lowercase" do
115
- let(:value) { 'abc' }
116
- it { is_expected.to eq 'abc' }
117
- end
118
-
119
- context "with uppercase" do
120
- let(:value) { 'ARCHIVAL_XML' }
121
- it { is_expected.to eq 'ARCHIVAL_XML' }
122
- end
123
-
124
- context "with camelcase" do
125
- let(:value) { 'descMetadata' }
126
- it { is_expected.to eq 'descMetadata' }
127
- end
128
-
129
- context "with dashes" do
130
- let(:value) { 'a-b' }
131
- it { is_expected.to eq 'a_b' }
132
- end
133
- end
134
-
135
- describe "#attached_files" do
136
- it "returns the datastream hash proxy" do
137
- allow(af_base).to receive(:load_datastreams)
138
- expect(af_base.attached_files).to be_a_kind_of(ActiveFedora::FilesHash)
139
- end
140
- end
141
-
142
- describe "#attach_file" do
143
- let(:file) { ActiveFedora::File.new }
144
-
145
- it "does not call save on the file" do
146
- expect(file).to receive(:save).never
147
- af_base.attach_file(file, 'part1')
148
- end
149
-
150
- it "adds the file to the attached_files hash" do
151
- expect {
152
- af_base.attach_file(file, 'part1')
153
- }.to change { af_base.attached_files.key?(:part1) }.from(false).to(true)
154
- end
155
-
156
- context "after attaching the file" do
157
- let(:dsid) { 'Abc' }
158
- before do
159
- af_base.attach_file(file, dsid)
160
- end
161
-
162
- it "adds the datastream to the object" do
163
- expect(af_base.attached_files['Abc']).to eq file
164
- end
165
-
166
- describe "dynamic accessors" do
167
- context "when the file is named with dash" do
168
- let(:dsid) { 'eac-cpf' }
169
- it "converts dashes to underscores" do
170
- expect(af_base.eac_cpf).to eq file
171
- end
172
- end
173
-
174
- context "when the file is named with underscore" do
175
- let(:dsid) { 'foo_bar' }
176
- it "preserves the underscore" do
177
- expect(af_base.foo_bar).to eq file
178
- end
179
- end
180
- end
181
- end
182
- end
183
-
184
- describe "#metadata_streams" do
185
- it "only is metadata datastreams" do
186
- ds1 = instance_double(ActiveFedora::File, metadata?: true)
187
- ds2 = instance_double(ActiveFedora::File, metadata?: true)
188
- ds3 = instance_double(ActiveFedora::File, metadata?: true)
189
- file_ds = instance_double(ActiveFedora::File, metadata?: false)
190
- allow(af_base).to receive(:attached_files).and_return(a: ds1, b: ds2, c: ds3, e: file_ds)
191
- expect(af_base.metadata_streams).to include(ds1, ds2, ds3)
192
- expect(af_base.metadata_streams).to_not include(file_ds)
193
- end
194
- end
195
-
196
- context "When the resource is using idiomatic basic containment" do
197
- before do
198
- class Sample1 < ActiveFedora::Base
199
- is_a_container
200
- end
201
- end
202
- after do
203
- Object.send(:remove_const, :Sample1)
204
- end
205
-
206
- before do
207
- child = obj.contains.build
208
- child.content = "Stuff"
209
- child.save!
210
- end
211
- let(:obj) { Sample1.create! }
212
- let(:obj2) { Sample1.find(obj.id) }
213
-
214
- it "doesn't conflate attached_file and contains" do
215
- expect(obj2.attached_files.keys).to be_empty
216
- end
217
- end
218
- end
@@ -1,146 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveFedora::Base do
4
- context "when properties are defined on an object" do
5
- before :all do
6
- class BarHistory4 < ActiveFedora::Base
7
- property :title, predicate: ::RDF::Vocab::DC.title do |index|
8
- index.as :symbol
9
- end
10
- property :abstract, predicate: ::RDF::Vocab::DC.abstract, multiple: false
11
- end
12
- end
13
-
14
- after :all do
15
- Object.send(:remove_const, :BarHistory4)
16
- end
17
-
18
- subject(:history) { obj }
19
- let(:obj) { BarHistory4.new(title: ['test1'], id: 'test:123') }
20
-
21
- describe "#attribute_names" do
22
- context "on an instance" do
23
- it "lists the attributes" do
24
- expect(history.attribute_names).to eq ["title", "abstract"]
25
- end
26
- end
27
-
28
- context "on a class" do
29
- it "lists the attributes" do
30
- expect(BarHistory4.attribute_names).to eq ["title", "abstract"]
31
- end
32
- end
33
- end
34
-
35
- describe "#inspect" do
36
- it "shows the attributes" do
37
- expect(history.inspect).to eq "#<BarHistory4 id: \"test:123\", title: [\"test1\"], abstract: nil>"
38
- end
39
-
40
- describe "with no attributes" do
41
- subject(:object) { described_class.new }
42
- it "shows a id" do
43
- expect(object.inspect).to eq "#<ActiveFedora::Base id: nil>"
44
- end
45
- end
46
-
47
- describe "with relationships" do
48
- before do
49
- class BarHistory2 < BarHistory4
50
- belongs_to :library, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasConstituent, class_name: 'BarHistory4'
51
- end
52
- history.library = library
53
- end
54
-
55
- subject(:history) { BarHistory2.new }
56
- let(:library) { BarHistory4.create }
57
-
58
- after do
59
- Object.send(:remove_const, :BarHistory2)
60
- end
61
-
62
- it "shows the library_id" do
63
- expect(history.inspect).to eq "#<BarHistory2 id: nil, title: [], abstract: nil, library_id: \"#{library.id}\">"
64
- end
65
- end
66
- end
67
-
68
- describe "#unique?" do
69
- it "reveals the unique properties" do
70
- expect(BarHistory4.unique?(:abstract)).to be true
71
- expect(BarHistory4.unique?(:title)).to be false
72
- end
73
- end
74
-
75
- describe "accessing attributes" do
76
- context "using generated methods" do
77
- it "returns values" do
78
- expect(history.title).to eq ['test1']
79
- end
80
- end
81
-
82
- context "using hash accessors" do
83
- context "on single value fields" do
84
- it "has a default value" do
85
- expect(history[:abstract]).to be_nil
86
- end
87
-
88
- context "when there are two assertions for the predicate" do
89
- before do
90
- history.resource[:abstract] = ['foo', 'bar']
91
- end
92
- it "raises an error if just returning the first value would cause data loss" do
93
- expect { history[:abstract] }.to raise_error ActiveFedora::ConstraintError, "Expected \"abstract\" of test:123 to have 0-1 statements, but there are 2"
94
- end
95
- end
96
- end
97
-
98
- context "multiple values" do
99
- it "returns values" do
100
- expect(history[:title]).to eq ['test1']
101
- end
102
- end
103
-
104
- context "on Fedora attributes" do
105
- it "return values" do
106
- expect(history[:type]).to be_empty
107
- expect(history[:rdf_label]).to contain_exactly("test1")
108
- end
109
- end
110
- end
111
- end
112
-
113
- describe 'change tracking' do
114
- it "is able to track change status" do
115
- expect {
116
- history.abstract = "Moo"
117
- }.to change { history.abstract_changed? }.from(false).to(true)
118
- end
119
- end
120
-
121
- describe "indexing" do
122
- let(:solr_doc) { obj.to_solr }
123
-
124
- it "indexs the attributes" do
125
- expect(solr_doc['title_ssim']).to eq ['test1']
126
- end
127
- end
128
-
129
- describe "when an object of the wrong cardinality is set" do
130
- it "does not allow passing a string to a multiple property writer" do
131
- expect { history.title = "Quack" }.to raise_error ArgumentError
132
- expect { history.title = ["Quack"] }.not_to raise_error
133
- expect { history.title = nil }.not_to raise_error
134
- expect { history.title = ActiveTriples::Resource.new }.to raise_error
135
- end
136
-
137
- it "does not allow an enumerable to a unique attribute writer" do
138
- expect { history.abstract = "Low" }.not_to raise_error
139
- expect { history.abstract = ["Low"] }
140
- .to raise_error ArgumentError, "You attempted to set the property `abstract' of test:123 to an enumerable value. However, this property is declared as singular."
141
- expect { history.abstract = nil }.not_to raise_error
142
- expect { history.abstract = ActiveTriples::Resource.new }.not_to raise_error
143
- end
144
- end
145
- end
146
- end