active-fedora 11.1.3 → 11.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_fedora/attached_files.rb +4 -0
- data/lib/active_fedora/version.rb +1 -1
- data/spec/unit/attached_files_spec.rb +23 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 680a242f0b724c0f1159629c8881a1e90df14f85
|
4
|
+
data.tar.gz: 9631a6201e7c3cf4c76c6fa1688c0087af8377ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c43409e731c3d9d9e1dc7b0d785ba233a33fe3f5204c49914a3c1bbd1aa29b4bb065bbad994c3cf97b382a0c89f685b8670c89689abb47d8d6433dc82094f051
|
7
|
+
data.tar.gz: f6227e309593c643a0d2d7234925478a869e99c1acd07f0376e2a81cf588373ebbea25af536ac9a30cc729b60fa21b56bc95c79659559c845420261baa8f9dfa
|
@@ -33,7 +33,11 @@ module ActiveFedora
|
|
33
33
|
resource.query(subject: resource, predicate: ::RDF::Vocab::LDP.contains).objects.map(&:to_s)
|
34
34
|
end
|
35
35
|
|
36
|
+
# Load any undeclared relationships or has_subresource relationships. These are non-idiomatic LDP
|
37
|
+
# because we are going to find the subresource by knowing it's subpath ahead of time.
|
38
|
+
# Does nothing if this object is using idiomatic basic containment, by declaring `is_a_container`
|
36
39
|
def load_attached_files
|
40
|
+
return if reflections[:contains] && reflections[:contains].macro == :is_a_container
|
37
41
|
contains_assertions.each do |file_uri|
|
38
42
|
path = file_uri.to_s.sub(uri + '/', '')
|
39
43
|
next if association(path.to_sym)
|
@@ -187,4 +187,27 @@ describe ActiveFedora::AttachedFiles do
|
|
187
187
|
expect(af_base.metadata_streams).to_not include(file_ds)
|
188
188
|
end
|
189
189
|
end
|
190
|
+
|
191
|
+
context "When the resource is using idiomatic basic containment" do
|
192
|
+
before do
|
193
|
+
class Sample1 < ActiveFedora::Base
|
194
|
+
is_a_container
|
195
|
+
end
|
196
|
+
end
|
197
|
+
after do
|
198
|
+
Object.send(:remove_const, :Sample1)
|
199
|
+
end
|
200
|
+
|
201
|
+
before do
|
202
|
+
child = obj.contains.build
|
203
|
+
child.content = "Stuff"
|
204
|
+
child.save!
|
205
|
+
end
|
206
|
+
let(:obj) { Sample1.create! }
|
207
|
+
let(:obj2) { Sample1.find(obj.id) }
|
208
|
+
|
209
|
+
it "doesn't conflate attached_file and contains" do
|
210
|
+
expect(obj2.attached_files.keys).to be_empty
|
211
|
+
end
|
212
|
+
end
|
190
213
|
end
|