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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c819c53e6318b54de501b004a3a907dc223ca7f2
4
- data.tar.gz: 9ee7ef31d8c30472b8aa37eacabb5f697bee0778
3
+ metadata.gz: b17884add8488a281ad74c3dc4642c959e771969
4
+ data.tar.gz: 77cc1824b8abd311a0abf9ccd8bfb513e3260fbe
5
5
  SHA512:
6
- metadata.gz: c280347c12e3a7a13ef3b394b2c7df63bc83c49f8f5eee24a4e71565b6da615cb179a437efca408d9b3bef51987215332c5d29704394810f55ba93e2eb9a628a
7
- data.tar.gz: 19dad27ff49953e76f6f19d7f599afe81d1df2b9badf7c849373474a44bacf903dd06352e438803652466a3c99914b65463f01753dd6952d21882a9531141b14
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
- # TODO is there any reason not to cast?
108
- if !options.has_key?(:cast)
109
- Deprecation.warn(Relation, "find's cast option will default to true", caller)
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)
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "6.6.0.pre1"
2
+ VERSION = "6.6.0.pre2"
3
3
  end
@@ -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
@@ -16,11 +16,21 @@ describe ActiveFedora::Base do
16
16
  end
17
17
 
18
18
  describe '#find_one' do
19
- it 'should notify of deprecation if no cast parameter is passed' do
20
- Deprecation.should_receive(:warn).at_least(1).times
21
- expect {
22
- ActiveFedora::Base.find_one('_PID_')
23
- }.to raise_error(ActiveFedora::ObjectNotFoundError)
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
 
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: 6.6.0.pre1
4
+ version: 6.6.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt