active-fedora 13.1.2 → 13.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) 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 +14 -13
  7. data/lib/active_fedora/version.rb +1 -1
  8. metadata +104 -206
  9. data/spec/config_helper.rb +0 -17
  10. data/spec/fixtures/dino.jpg +0 -0
  11. data/spec/fixtures/dino_jpg_no_file_ext +0 -0
  12. data/spec/fixtures/minivan.jpg +0 -0
  13. data/spec/fixtures/rails_root/config/fake_fedora.yml +0 -7
  14. data/spec/fixtures/rails_root/config/fedora.yml +0 -12
  15. data/spec/fixtures/rails_root/config/solr.yml +0 -15
  16. data/spec/fixtures/rails_root/config/solr_mappings.yml +0 -16
  17. data/spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml +0 -9
  18. data/spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml +0 -17
  19. data/spec/integration/associations/rdf_spec.rb +0 -61
  20. data/spec/integration/associations_spec.rb +0 -680
  21. data/spec/integration/attached_files_spec.rb +0 -146
  22. data/spec/integration/attributes_spec.rb +0 -73
  23. data/spec/integration/autosave_association_spec.rb +0 -24
  24. data/spec/integration/base_spec.rb +0 -184
  25. data/spec/integration/basic_contains_association_spec.rb +0 -121
  26. data/spec/integration/belongs_to_association_spec.rb +0 -260
  27. data/spec/integration/caching_spec.rb +0 -59
  28. data/spec/integration/clean_connection_spec.rb +0 -21
  29. data/spec/integration/collection_association_spec.rb +0 -166
  30. data/spec/integration/date_time_properties_spec.rb +0 -41
  31. data/spec/integration/delete_all_spec.rb +0 -64
  32. data/spec/integration/direct_container_spec.rb +0 -250
  33. data/spec/integration/directly_contains_one_association_spec.rb +0 -96
  34. data/spec/integration/eradicate_spec.rb +0 -52
  35. data/spec/integration/fedora_solr_sync_spec.rb +0 -30
  36. data/spec/integration/file_fixity_spec.rb +0 -36
  37. data/spec/integration/file_spec.rb +0 -221
  38. data/spec/integration/generators/fedora_generator_spec.rb +0 -26
  39. data/spec/integration/generators/solr_generator_spec.rb +0 -23
  40. data/spec/integration/gone_spec.rb +0 -41
  41. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +0 -414
  42. data/spec/integration/has_many_associations_spec.rb +0 -436
  43. data/spec/integration/has_subresource_spec.rb +0 -34
  44. data/spec/integration/indexing/descendant_fetcher_spec.rb +0 -64
  45. data/spec/integration/indexing_spec.rb +0 -110
  46. data/spec/integration/indirect_container_spec.rb +0 -290
  47. data/spec/integration/json_serialization_spec.rb +0 -32
  48. data/spec/integration/marshal_spec.rb +0 -39
  49. data/spec/integration/nested_attribute_spec.rb +0 -177
  50. data/spec/integration/nested_hash_resources_spec.rb +0 -43
  51. data/spec/integration/persistence_spec.rb +0 -37
  52. data/spec/integration/query_result_builder_spec.rb +0 -37
  53. data/spec/integration/rdf_nested_attributes_spec.rb +0 -85
  54. data/spec/integration/relation_delegation_spec.rb +0 -52
  55. data/spec/integration/relation_spec.rb +0 -117
  56. data/spec/integration/scoped_query_spec.rb +0 -134
  57. data/spec/integration/scoping_spec.rb +0 -48
  58. data/spec/integration/solr_hit_spec.rb +0 -32
  59. data/spec/integration/versionable_spec.rb +0 -256
  60. data/spec/integration/with_metadata_spec.rb +0 -111
  61. data/spec/lib/active_fedora/null_logger_spec.rb +0 -10
  62. data/spec/rcov.opts +0 -2
  63. data/spec/spec.opts +0 -5
  64. data/spec/spec_helper.rb +0 -106
  65. data/spec/support/an_active_model.rb +0 -29
  66. data/spec/unit/active_fedora/indexing/inserter_spec.rb +0 -35
  67. data/spec/unit/active_fedora_spec.rb +0 -118
  68. data/spec/unit/aggregation/list_source_spec.rb +0 -134
  69. data/spec/unit/aggregation/ordered_reader_spec.rb +0 -43
  70. data/spec/unit/association_hash_spec.rb +0 -64
  71. data/spec/unit/attached_files_spec.rb +0 -218
  72. data/spec/unit/attributes_spec.rb +0 -146
  73. data/spec/unit/base_active_model_spec.rb +0 -28
  74. data/spec/unit/base_cma_spec.rb +0 -15
  75. data/spec/unit/base_extra_spec.rb +0 -33
  76. data/spec/unit/base_spec.rb +0 -328
  77. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +0 -8
  78. data/spec/unit/callback_spec.rb +0 -65
  79. data/spec/unit/change_set_spec.rb +0 -60
  80. data/spec/unit/checksum_spec.rb +0 -25
  81. data/spec/unit/code_configurator_spec.rb +0 -41
  82. data/spec/unit/collection_proxy_spec.rb +0 -25
  83. data/spec/unit/config_spec.rb +0 -18
  84. data/spec/unit/core/fedora_id_translator_spec.rb +0 -29
  85. data/spec/unit/core/fedora_uri_translator_spec.rb +0 -19
  86. data/spec/unit/core/logger_spec.rb +0 -18
  87. data/spec/unit/core_spec.rb +0 -242
  88. data/spec/unit/default_model_mapper_spec.rb +0 -39
  89. data/spec/unit/fedora_spec.rb +0 -31
  90. data/spec/unit/file/streaming_spec.rb +0 -33
  91. data/spec/unit/file_configurator_spec.rb +0 -295
  92. data/spec/unit/file_io_spec.rb +0 -137
  93. data/spec/unit/file_path_builder_spec.rb +0 -18
  94. data/spec/unit/file_spec.rb +0 -489
  95. data/spec/unit/files_hash_spec.rb +0 -52
  96. data/spec/unit/filter_spec.rb +0 -133
  97. data/spec/unit/finder_methods_spec.rb +0 -154
  98. data/spec/unit/fixity_service_spec.rb +0 -128
  99. data/spec/unit/forbidden_attributes_protection_spec.rb +0 -50
  100. data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -125
  101. data/spec/unit/has_many_association_spec.rb +0 -131
  102. data/spec/unit/indexers/global_indexer_spec.rb +0 -41
  103. data/spec/unit/indexing/map/index_object_spec.rb +0 -25
  104. data/spec/unit/indexing/map_spec.rb +0 -27
  105. data/spec/unit/indexing_service_spec.rb +0 -28
  106. data/spec/unit/indexing_spec.rb +0 -86
  107. data/spec/unit/inheritance_spec.rb +0 -60
  108. data/spec/unit/ldp_resource_spec.rb +0 -15
  109. data/spec/unit/loadable_from_json_spec.rb +0 -40
  110. data/spec/unit/logger_spec.rb +0 -19
  111. data/spec/unit/model_classifier_spec.rb +0 -49
  112. data/spec/unit/ordered_spec.rb +0 -367
  113. data/spec/unit/orders/list_node_spec.rb +0 -151
  114. data/spec/unit/orders/ordered_list_spec.rb +0 -335
  115. data/spec/unit/orders/reflection_spec.rb +0 -22
  116. data/spec/unit/pathing_spec.rb +0 -35
  117. data/spec/unit/persistence_spec.rb +0 -115
  118. data/spec/unit/property_predicate_spec.rb +0 -35
  119. data/spec/unit/property_spec.rb +0 -25
  120. data/spec/unit/query_result_builder_spec.rb +0 -31
  121. data/spec/unit/query_spec.rb +0 -307
  122. data/spec/unit/querying_spec.rb +0 -24
  123. data/spec/unit/rdf/indexing_service_spec.rb +0 -114
  124. data/spec/unit/rdf_vocab_spec.rb +0 -30
  125. data/spec/unit/readonly_spec.rb +0 -24
  126. data/spec/unit/reflection_spec.rb +0 -42
  127. data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +0 -37
  128. data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +0 -38
  129. data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +0 -38
  130. data/spec/unit/schema_indexing_strategy_spec.rb +0 -68
  131. data/spec/unit/scoping_spec.rb +0 -67
  132. data/spec/unit/serializers_spec.rb +0 -19
  133. data/spec/unit/solr_config_options_spec.rb +0 -57
  134. data/spec/unit/solr_hit_spec.rb +0 -57
  135. data/spec/unit/solr_query_builder_spec.rb +0 -18
  136. data/spec/unit/solr_service_spec.rb +0 -165
  137. data/spec/unit/sparql_insert_spec.rb +0 -31
  138. data/spec/unit/validations_spec.rb +0 -92
  139. data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +0 -29
  140. data/spec/unit/with_metadata/metadata_node_spec.rb +0 -69
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe ActiveFedora::Indexing::DescendantFetcher do
4
- before do
5
- class Thing < ActiveFedora::Base
6
- property :title, predicate: ::RDF::Vocab::DC.title
7
- end
8
- class Source < ActiveFedora::Base
9
- is_a_container class_name: 'Thing'
10
- end
11
- end
12
- after do
13
- Object.send(:remove_const, :Source)
14
- Object.send(:remove_const, :Thing)
15
- end
16
-
17
- let(:parent) { Source.create }
18
- let(:child) { parent.contains.create(title: ['my title']) }
19
- let(:other_parent) { Source.create }
20
- let!(:source_uris) { [parent, other_parent].map(&:uri).map(&:to_s) }
21
- let!(:thing_uris) { [child].map(&:uri).map(&:to_s) }
22
- let(:uri) { ActiveFedora.fedora.base_uri }
23
- let(:fetcher) { described_class.new(uri) }
24
-
25
- describe '.descendant_and_self_uris' do
26
- context 'with default priority models' do
27
- it 'returns uris for all objects by walking tree' do
28
- expect(fetcher.descendant_and_self_uris).to match_array(source_uris + thing_uris)
29
- end
30
- end
31
- context 'when supplying priority models' do
32
- let(:priority_models) { ['Thing'] }
33
- let(:fetcher) { described_class.new(uri, priority_models: priority_models) }
34
- it 'returns priority model uris first' do
35
- expect(fetcher.descendant_and_self_uris.slice(0..(thing_uris.count - 1))).to match_array(thing_uris)
36
- end
37
- end
38
- end
39
- describe '.descendant_and_self_uris_partitioned' do
40
- context 'with default priority models' do
41
- it 'returns' do
42
- expect(fetcher.descendant_and_self_uris_partitioned.to_a).to match_array([[:priority, []], [:other, match_array(source_uris + thing_uris)]])
43
- end
44
- end
45
- context 'when supplying priority models' do
46
- let(:priority_models) { ['Thing'] }
47
- let(:fetcher) { described_class.new(uri, priority_models: priority_models) }
48
- it 'returns' do
49
- expect(fetcher.descendant_and_self_uris_partitioned.to_a).to match_array([[:priority, match_array(thing_uris)], [:other, match_array(source_uris)]])
50
- end
51
- end
52
- end
53
- describe '.descendant_and_self_uris_partitioned_by_model' do
54
- it 'returns' do
55
- expect(fetcher.descendant_and_self_uris_partitioned_by_model.to_a).to match_array([['Source', match_array(source_uris)], ['Thing', match_array(thing_uris)]])
56
- end
57
- context 'excluding self' do
58
- let(:fetcher) { described_class.new(parent.uri, exclude_self: true) }
59
- it 'returns' do
60
- expect(fetcher.descendant_and_self_uris_partitioned_by_model.to_a).to match_array([['Thing', [child.uri.to_s]]])
61
- end
62
- end
63
- end
64
- end
@@ -1,110 +0,0 @@
1
- require 'spec_helper'
2
- @@last_id = 0
3
-
4
- describe ActiveFedora::Base do
5
- describe "descendant_uris" do
6
- before do
7
- ids.each do |id|
8
- described_class.create id: id
9
- end
10
- end
11
-
12
- def root_uri(ids = [])
13
- ActiveFedora::Base.id_to_uri(ids.first)
14
- end
15
-
16
- context 'when there there are no descendants' do
17
- let(:ids) { ['foo'] }
18
-
19
- it 'returns an array containing only the URI passed to it' do
20
- expect(described_class.descendant_uris(root_uri(ids))).to eq ids.map { |id| described_class.id_to_uri(id) }
21
- end
22
- end
23
-
24
- context 'when there are > 1 descendants' do
25
- let(:ids) { ['foo', 'foo/bar', 'foo/bar/chu'] }
26
-
27
- it 'returns an array containing the URI passed to it, as well as all descendant URIs' do
28
- expect(described_class.descendant_uris(root_uri(ids))).to eq ids.map { |id| described_class.id_to_uri(id) }
29
- end
30
- end
31
-
32
- context 'when some of the decendants are not RDFSources' do
33
- let(:ids) { ['foo', 'foo/bar'] }
34
- let(:file) { ActiveFedora::File.new(described_class.id_to_uri('foo/bar/bax')) }
35
-
36
- before do
37
- file.content = "Hello!!!"
38
- file.save
39
- end
40
-
41
- it "does not put the datastream in the decendants list" do
42
- expect(described_class.descendant_uris(root_uri(ids))).not_to include file.uri
43
- end
44
- end
45
-
46
- describe "when some of the descendants are prioritized models" do
47
- around do |example|
48
- class PriorityModel < ActiveFedora::Base
49
- end
50
- original_defaults = ActiveFedora::Indexing::DescendantFetcher.default_priority_models
51
- ActiveFedora::Indexing::DescendantFetcher.default_priority_models = ["PriorityModel"]
52
-
53
- example.run
54
-
55
- ActiveFedora::Indexing::DescendantFetcher.default_priority_models = original_defaults
56
- Object.send(:remove_const, :PriorityModel)
57
- end
58
- let(:ids) { ['foo', 'bar'] }
59
- let!(:priority_models) { [PriorityModel.create, PriorityModel.create] }
60
-
61
- it "puts prioritized model ids first" do
62
- expect(described_class.descendant_uris(ActiveFedora.fedora.base_uri).slice(0..(priority_models.count - 1))).to contain_exactly(*priority_models.collect(&:uri).collect(&:to_s))
63
- end
64
- end
65
-
66
- describe "reindex_everything" do
67
- let(:ids) { ['foo', 'bar'] }
68
- let(:solr) { ActiveFedora::SolrService.instance.conn }
69
- before do
70
- solr.delete_by_query('*:*', params: { 'softCommit' => true })
71
- end
72
- it "adds object to solr" do
73
- expect {
74
- described_class.reindex_everything
75
- }.to change { ActiveFedora::SolrService.query('id:foo').size }.from(0).to(1)
76
- end
77
- end
78
- end
79
-
80
- describe "with an autosave association, where some records are deleted" do
81
- before do
82
- class GenericFile < ActiveFedora::Base
83
- has_many :permissions, predicate: ::RDF::Vocab::ACL.accessTo
84
- accepts_nested_attributes_for :permissions, allow_destroy: true
85
- property :title, predicate: ::RDF::Vocab::DC.title
86
-
87
- def to_solr
88
- super.tap do |doc|
89
- doc['permissions_ssim'] = permission_ids
90
- end
91
- end
92
- end
93
-
94
- class Permission < ActiveFedora::Base
95
- belongs_to :generic_file, predicate: ::RDF::Vocab::ACL.accessTo
96
- end
97
- end
98
-
99
- let(:p1) { Permission.create! }
100
- let(:p2) { Permission.create! }
101
- let(:gf) { GenericFile.create(permissions: [p1, p2]) }
102
-
103
- before { gf.update(permissions_attributes: [{ id: p1.id, _destroy: 'true' }]) }
104
-
105
- it "saves to solr correctly" do
106
- result = ActiveFedora::SolrService.query("id:#{gf.id}", rows: 10).first['permissions_ssim']
107
- expect(result).to eq [p2.id]
108
- end
109
- end
110
- end
@@ -1,290 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Indirect containers" do
4
- before do
5
- class RelatedObject < ActiveFedora::Base
6
- property :title, predicate: ::RDF::Vocab::DC.title, multiple: false
7
- end
8
- class Proxy < ActiveFedora::Base
9
- belongs_to :proxy_for, predicate: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'), class_name: 'ActiveFedora::Base'
10
- end
11
- end
12
-
13
- after do
14
- Object.send(:remove_const, :RelatedObject)
15
- Object.send(:remove_const, :Proxy)
16
- end
17
-
18
- describe "#include?" do
19
- before do
20
- class FooHistory < ActiveFedora::Base
21
- indirectly_contains :related_objects,
22
- has_member_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/aggregates'),
23
- inserted_content_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'),
24
- through: 'Proxy', foreign_key: :proxy_for
25
- end
26
- end
27
-
28
- after do
29
- Object.send(:remove_const, :FooHistory)
30
- end
31
-
32
- let(:foo) { FooHistory.new }
33
-
34
- let(:file1) { RelatedObject.create }
35
-
36
- before do
37
- foo.related_objects << file1
38
- foo.save
39
- end
40
-
41
- context "when it is not loaded" do
42
- context "and it contains the file" do
43
- subject { foo.reload.related_objects.include? file1 }
44
- it { is_expected.to be true }
45
- end
46
-
47
- context "and it doesn't contain the file" do
48
- let!(:file2) { RelatedObject.create }
49
- subject { foo.reload.related_objects.include? file2 }
50
- it { is_expected.to be false }
51
- end
52
- end
53
-
54
- context "when it is loaded" do
55
- before { foo.related_objects.to_a } # initial load of the association
56
-
57
- context "and it contains the file" do
58
- subject { foo.related_objects.include? file1 }
59
- it { is_expected.to be true }
60
- end
61
-
62
- context "and it doesn't contain the file" do
63
- let!(:file2) { RelatedObject.create }
64
- subject { foo.related_objects.include? file2 }
65
- it { is_expected.to be false }
66
- end
67
- end
68
- end
69
-
70
- describe "delete" do
71
- before do
72
- class FooHistory < ActiveFedora::Base
73
- indirectly_contains :related_objects,
74
- has_member_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/aggregates'), inserted_content_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'),
75
- through: 'Proxy',
76
- foreign_key: :proxy_for
77
- end
78
- end
79
-
80
- after do
81
- Object.send(:remove_const, :FooHistory)
82
- end
83
-
84
- it "deletes only one object" do
85
- foo = FooHistory.new
86
- foo.related_objects.build
87
- file2 = foo.related_objects.build
88
- foo.save
89
- expect(foo.related_objects.each.count).to eq(2)
90
- foo.related_objects.delete(file2)
91
- expect(foo.related_objects.each.count).to eq 1
92
- foo = FooHistory.find(foo.id)
93
- expect(foo.related_objects.each.count).to eq(1)
94
- end
95
- end
96
-
97
- describe "#indirectly_contains" do
98
- context "when the class is implied" do
99
- before do
100
- class FooHistory < ActiveFedora::Base
101
- # TODO: inserted_content_relation can look up the predicate at options[:through].constantize._reflect_on_association(options[:foreign_key]).predicate
102
- indirectly_contains :related_objects,
103
- has_member_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/aggregates'),
104
- inserted_content_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'),
105
- through: 'Proxy',
106
- foreign_key: :proxy_for
107
- end
108
- end
109
- after do
110
- Object.send(:remove_const, :FooHistory)
111
- end
112
-
113
- let(:file) { o.related_objects.build }
114
- let(:reloaded) { FooHistory.find(o.id) }
115
-
116
- context "with no related_objects" do
117
- subject { o.related_objects }
118
- let(:o) { FooHistory.new }
119
-
120
- it { is_expected.to be_empty }
121
- it { is_expected.to eq [] }
122
- end
123
-
124
- context "when the object exists" do
125
- let(:o) { FooHistory.create }
126
-
127
- before do
128
- file.title = "HMMM"
129
- o.save
130
- end
131
-
132
- describe "#first" do
133
- subject(:first) { reloaded.related_objects.first }
134
- it "has the content" do
135
- expect(first.title).to eq 'HMMM'
136
- end
137
- end
138
-
139
- describe "#==" do
140
- subject { reloaded.related_objects }
141
-
142
- # it delegates to to_a
143
- it { is_expected.to eq [file] }
144
- end
145
-
146
- describe "#concat" do
147
- it "doesn't load all the members" do
148
- other = FooHistory.find(o.id)
149
- r3 = RelatedObject.create
150
- other.related_objects << r3
151
- expect(other.related_objects.loaded?).to be false
152
- # Calling the reader method triggers a load
153
- expect(other.related_objects.size).to eq 2
154
- expect(other.related_objects.loaded?).to be true
155
- expect(other.related_objects).to include(r3)
156
- end
157
- end
158
-
159
- describe "#append" do
160
- let(:file2) { o.related_objects.build }
161
- it "has two related_objects" do
162
- expect(o.related_objects).to contain_exactly file, file2
163
- end
164
-
165
- context "and then saved/reloaded" do
166
- before do
167
- file2.title = "Derp"
168
- o.save!
169
- end
170
-
171
- it "has two related_objects" do
172
- expect(reloaded.related_objects).to contain_exactly file, file2
173
- end
174
- end
175
- end
176
-
177
- describe "#ids_reader" do
178
- context "with persisted members" do
179
- it "returns the ids" do
180
- expect(reloaded.related_object_ids).to eq [file.id]
181
- end
182
- end
183
-
184
- context "after save" do
185
- it "returns correctly" do
186
- o.save
187
- expect(o.related_object_ids).to eq [file.id]
188
- end
189
- end
190
-
191
- context "with some members in memory" do
192
- let(:file2) { RelatedObject.create }
193
- before do
194
- reloaded.related_objects << file2
195
- end
196
-
197
- it "returns the ids" do
198
- expect(reloaded.related_object_ids).to contain_exactly file.id, file2.id
199
- end
200
- end
201
- end
202
-
203
- describe "remove" do
204
- it "is able to remove" do
205
- o.related_objects = []
206
- o.save!
207
-
208
- expect(reloaded.related_objects).to eq []
209
- end
210
- end
211
- end
212
- end
213
-
214
- context "when the class is provided" do
215
- before do
216
- class Different < ActiveFedora::Base
217
- property :title, predicate: ::RDF::Vocab::DC.title, multiple: false
218
- end
219
- class FooHistory < ActiveFedora::Base
220
- indirectly_contains :related_objects, has_member_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/aggregates'), inserted_content_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'), class_name: 'Different', through: 'Proxy', foreign_key: :proxy_for
221
- end
222
- end
223
- after do
224
- Object.send(:remove_const, :FooHistory)
225
- Object.send(:remove_const, :Different)
226
- end
227
-
228
- let(:o) { FooHistory.create }
229
- let(:file) { o.related_objects.build }
230
- let(:reloaded) { FooHistory.find(o.id) }
231
-
232
- describe "#build" do
233
- subject { file }
234
- it { is_expected.to be_kind_of Different }
235
- end
236
-
237
- context "when the object exists" do
238
- before do
239
- file.title = "HMMM"
240
- o.save
241
- end
242
-
243
- describe "#first" do
244
- subject(:first) { reloaded.related_objects.first }
245
- it "has the content" do
246
- expect(first.title).to eq 'HMMM'
247
- end
248
- end
249
- end
250
- end
251
-
252
- context "when using is_member_of_relation" do # , skip: "As far as I can tell, FC4 doesn't support IndirectContainer with isMemberOfRelation" do
253
- before do
254
- class FooHistory < ActiveFedora::Base
255
- indirectly_contains :related_objects, is_member_of_relation: ::RDF::URI.new("http://example.com/isWithin"), inserted_content_relation: ::RDF::URI.new('http://www.openarchives.org/ore/terms/proxyFor'), through: 'Proxy', foreign_key: :proxy_for
256
- end
257
- end
258
- after do
259
- Object.send(:remove_const, :FooHistory)
260
- end
261
-
262
- let(:file) { o.related_objects.build }
263
- let(:reloaded) { FooHistory.find(o.id) }
264
-
265
- context "with no related_objects" do
266
- subject { o.related_objects }
267
- let(:o) { FooHistory.new }
268
-
269
- it { is_expected.to be_empty }
270
- it { is_expected.to eq [] }
271
- end
272
-
273
- context "when the object exists" do
274
- let(:o) { FooHistory.create }
275
-
276
- before do
277
- file.title = "HMMM"
278
- o.save
279
- end
280
-
281
- describe "#first" do
282
- subject(:first) { reloaded.related_objects.first }
283
- it "has the content" do
284
- expect(first.title).to eq 'HMMM'
285
- end
286
- end
287
- end
288
- end
289
- end
290
- end