active-fedora 7.0.0 → 7.0.1
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c10a4702718ed6d75d2ae3a50d68f2f7df312ed
|
4
|
+
data.tar.gz: 1f789a3692431f14efbda9e097f0e2edfdb87881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a00cdb7d97f144159944cee46347cd092fc8251b54317c23aea390ba35861906077fac78890f28e7976c53f5ddcfae1320998c8532a4ecbcf752360035c97ce
|
7
|
+
data.tar.gz: 8e73ac6816f0ca3bd51a3724c6654bdb1031d75ae938d6464b1e88423a590e5a5e725c0b986548dcbfb8c4ea85851fcf00365bf4ecc5d6ebb16dc63a109a771e
|
@@ -90,6 +90,21 @@ module ActiveFedora
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
# Returns true if the collection is empty.
|
94
|
+
#
|
95
|
+
# If the collection has been loaded it is equivalent to <tt>collection.
|
96
|
+
# size.zero?</tt>. If the collection has not been loaded, it is equivalent to
|
97
|
+
# <tt>collection.count_records == 0</tt>. If the collection has not already been
|
98
|
+
# loaded and you are going to fetch the records anyway it is better to
|
99
|
+
# check <tt>collection.length.zero?</tt>.
|
100
|
+
def empty?
|
101
|
+
if loaded?
|
102
|
+
size.zero?
|
103
|
+
else
|
104
|
+
@target.blank? && count_records == 0
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
93
108
|
# Replace this collection with +other_array+
|
94
109
|
# This will perform a diff and delete/add only records that have changed.
|
95
110
|
def replace(other_array)
|
@@ -123,24 +123,40 @@ describe ActiveFedora::Base do
|
|
123
123
|
|
124
124
|
let (:book) { Book.create }
|
125
125
|
let (:collection) { Collection.create }
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
126
|
+
|
127
|
+
context "when the book is a member of the collection" do
|
128
|
+
before do
|
129
|
+
book.collections << collection
|
130
|
+
book.save!
|
131
|
+
end
|
132
|
+
after do
|
133
|
+
collection.delete
|
134
|
+
book.delete
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should have a collection" do
|
138
|
+
book.relationships(:is_member_of_collection).should == [collection.internal_uri]
|
139
|
+
book.collections.should == [collection]
|
140
|
+
end
|
141
|
+
it "habtm should not set foreign relationships if :inverse_of is not specified" do
|
142
|
+
collection.relationships(:is_member_of_collection).should == []
|
143
|
+
end
|
144
|
+
it "should load the collections" do
|
145
|
+
reloaded = Book.find(book.pid)
|
146
|
+
reloaded.collections.should == [collection]
|
147
|
+
end
|
148
|
+
|
149
|
+
describe "#empty?" do
|
150
|
+
subject { book.collections }
|
151
|
+
its(:empty?) { should be_false }
|
152
|
+
end
|
140
153
|
end
|
141
|
-
|
142
|
-
|
143
|
-
|
154
|
+
|
155
|
+
context "when a book isn't in a collection" do
|
156
|
+
describe "#empty?" do
|
157
|
+
subject { book.collections }
|
158
|
+
its(:empty?) { should be_true }
|
159
|
+
end
|
144
160
|
end
|
145
161
|
end
|
146
162
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|