active-fedora 6.6.0.pre1 → 6.6.0.pre2
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/querying.rb +2 -2
- data/lib/active_fedora/relation.rb +5 -4
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/model_spec.rb +8 -1
- data/spec/unit/query_spec.rb +15 -5
- 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: b17884add8488a281ad74c3dc4642c959e771969
|
4
|
+
data.tar.gz: 77cc1824b8abd311a0abf9ccd8bfb513e3260fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50b13f76fcca7a1a5331523849ab7a454800b8ba6d4af7c0da33e48706a981ea71a25a6a5b3158edd0bc3d7deb8875afdb7446dfdfe4378f3e4e6e6570d9f9f3
|
7
|
+
data.tar.gz: 0fe70f8ca9eacb61b274c84d33403e208228e955ebfd15e285f71d0901bcd5618f533048628d0c616af6da072535123101756b0a9ca034f6a939aac034e65d97
|
@@ -111,9 +111,9 @@ module ActiveFedora
|
|
111
111
|
# @example because the object hydra:dataset1 asserts it is a Dataset (hasModel info:fedora/afmodel:Dataset), return a Dataset object (not a Book).
|
112
112
|
# Book.find_one("hydra:dataset1")
|
113
113
|
def find_one(pid, cast=nil)
|
114
|
-
if cast.nil?
|
114
|
+
if self == ActiveFedora::Base && cast.nil?
|
115
115
|
cast = false
|
116
|
-
Deprecation.warn(Querying, "find_one's cast parameter will default to true", caller)
|
116
|
+
Deprecation.warn(Querying, "find_one's cast parameter will default to true in ActiveFedora 7.0.0. If you want to maintain your existing behavior set `false' as the second parameter.", caller)
|
117
117
|
end
|
118
118
|
inner = DigitalObject.find(self, pid)
|
119
119
|
af_base = self.allocate.init_with(inner)
|
@@ -104,11 +104,12 @@ module ActiveFedora
|
|
104
104
|
return to_a.find { |*block_args| yield(*block_args) } if block_given?
|
105
105
|
options = args.extract_options!
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
cast = if self == ActiveFedora::Base && !options.has_key?(:cast)
|
108
|
+
Deprecation.warn(Relation, "find's cast option will default to true in ActiveFedora 7.0.0. To preserve existing behavior send parameter: `:cast=> false`", caller)
|
109
|
+
false
|
110
|
+
else
|
111
|
+
options.delete(:cast)
|
110
112
|
end
|
111
|
-
cast = options.delete(:cast)
|
112
113
|
if options[:sort]
|
113
114
|
# Deprecate sort sometime?
|
114
115
|
sort = options.delete(:sort)
|
@@ -42,13 +42,20 @@ describe ActiveFedora::Model do
|
|
42
42
|
subject { ActiveFedora::Base.find(@test_instance.pid, :cast=>true) }
|
43
43
|
it { should be_instance_of ModelIntegrationSpec::Basic}
|
44
44
|
end
|
45
|
-
describe "#find with a valid pid without cast" do
|
45
|
+
describe "#find with a valid pid without cast on Base" do
|
46
46
|
subject { ActiveFedora::Base.find(@test_instance.pid) }
|
47
47
|
before(:each) do
|
48
48
|
Deprecation.should_receive(:warn).at_least(1).times
|
49
49
|
end
|
50
50
|
it { should be_instance_of ActiveFedora::Base}
|
51
51
|
end
|
52
|
+
describe "#find with a valid pid without cast on a model extending Base" do
|
53
|
+
subject { ModelIntegrationSpec::Basic.find(@test_instance.pid) }
|
54
|
+
before(:each) do
|
55
|
+
Deprecation.should_not_receive(:warn)
|
56
|
+
end
|
57
|
+
it { should be_instance_of ModelIntegrationSpec::Basic}
|
58
|
+
end
|
52
59
|
end
|
53
60
|
|
54
61
|
describe "#load_instance_from_solr" do
|
data/spec/unit/query_spec.rb
CHANGED
@@ -16,11 +16,21 @@ describe ActiveFedora::Base do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#find_one' do
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
describe "when called on AF::Base" do
|
20
|
+
it 'should notify of deprecation if no cast parameter is passed' do
|
21
|
+
Deprecation.should_receive(:warn).at_least(1).times
|
22
|
+
expect {
|
23
|
+
ActiveFedora::Base.find_one('_PID_')
|
24
|
+
}.to raise_error(ActiveFedora::ObjectNotFoundError)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe "when called on a model extending AF::Base" do
|
28
|
+
it 'should not have a deprecation warning when no cast parameter is passed' do
|
29
|
+
Deprecation.should_not_receive(:warn)
|
30
|
+
expect {
|
31
|
+
SpecModel::Basic.find_one('_PID_')
|
32
|
+
}.to raise_error(ActiveFedora::ObjectNotFoundError)
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
26
36
|
|