active-fedora 3.2.0.pre4 → 3.2.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/active_fedora/base.rb +7 -0
- data/lib/active_fedora/version.rb +1 -1
- data/spec/unit/base_spec.rb +10 -8
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/active_fedora/base.rb
CHANGED
@@ -131,6 +131,13 @@ module ActiveFedora
|
|
131
131
|
# post.properties.title # => 'hello world'
|
132
132
|
def init_with(inner_obj)
|
133
133
|
@inner_object = inner_obj
|
134
|
+
unless @inner_object.is_a? SolrDigitalObject
|
135
|
+
## Replace existing unchanged datastreams with the definitions found in this class
|
136
|
+
@inner_object.original_class = self.class
|
137
|
+
ds_specs.keys.each do |key|
|
138
|
+
@inner_object.datastreams.delete(key) unless @inner_object.datastreams[key].changed.include?(:content)
|
139
|
+
end
|
140
|
+
end
|
134
141
|
load_datastreams
|
135
142
|
run_callbacks :find
|
136
143
|
run_callbacks :initialize
|
data/spec/unit/base_spec.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
3
|
-
# require 'active_fedora'
|
4
|
-
# require 'active_fedora/base'
|
5
|
-
# require 'active_fedora/metadata_datastream'
|
6
|
-
# require 'time'
|
7
|
-
# require 'date'
|
8
|
-
#
|
9
2
|
@@last_pid = 0
|
10
3
|
|
11
4
|
describe ActiveFedora::Base do
|
@@ -25,6 +18,7 @@ describe ActiveFedora::Base do
|
|
25
18
|
delegate :swank, :to=>'someData'
|
26
19
|
end
|
27
20
|
class FooAdaptation < ActiveFedora::Base
|
21
|
+
has_metadata :type=>ActiveFedora::NokogiriDatastream, :name=>'someData'
|
28
22
|
end
|
29
23
|
end
|
30
24
|
|
@@ -588,12 +582,20 @@ describe ActiveFedora::Base do
|
|
588
582
|
end
|
589
583
|
it "should propagate modified datastreams to the adapted object" do
|
590
584
|
@test_object = FooHistory.new()
|
591
|
-
@test_object.datastreams['someData']
|
585
|
+
orig_ds = @test_object.datastreams['someData']
|
586
|
+
orig_ds.content="YYY"
|
592
587
|
adapted = @test_object.adapt_to(FooAdaptation)
|
593
588
|
adapted.datastreams.keys.should include 'someData'
|
589
|
+
adapted.datastreams['someData'].should == orig_ds
|
594
590
|
adapted.datastreams['someData'].content.should == "YYY"
|
595
591
|
adapted.datastreams['someData'].changed?.should be_true
|
596
592
|
end
|
593
|
+
it "should use the datastream definitions from the adapted object" do
|
594
|
+
@test_object = FooHistory.new()
|
595
|
+
adapted = @test_object.adapt_to(FooAdaptation)
|
596
|
+
adapted.datastreams.keys.should include 'someData'
|
597
|
+
adapted.datastreams['someData'].class.should == ActiveFedora::NokogiriDatastream
|
598
|
+
end
|
597
599
|
end
|
598
600
|
|
599
601
|
describe ".to_xml" do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1923832035
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 3.2.0.
|
11
|
+
- 5
|
12
|
+
version: 3.2.0.pre5
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Matt Zumwalt
|