active-fedora 4.0.0.rc14 → 4.0.0.rc15
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.
- data/Gemfile.lock +1 -1
- data/History.txt +1 -1
- data/lib/active_fedora/base.rb +1 -1
- data/lib/active_fedora/file_configurator.rb +0 -1
- data/lib/active_fedora/solr_digital_object.rb +2 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/model_spec.rb +6 -0
- data/spec/samples/models/hydrangea_article.rb +1 -0
- data/spec/unit/solr_digital_object_spec.rb +29 -10
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/lib/active_fedora/base.rb
CHANGED
@@ -372,7 +372,7 @@ module ActiveFedora
|
|
372
372
|
ActiveFedora::Base
|
373
373
|
end
|
374
374
|
|
375
|
-
obj = klass.allocate.init_with(SolrDigitalObject.new(solr_doc,
|
375
|
+
obj = klass.allocate.init_with(SolrDigitalObject.new(solr_doc, klass))
|
376
376
|
#set by default to load any dependent relationship objects from solr as well
|
377
377
|
#need to call rels_ext once so it exists when iterating over datastreams
|
378
378
|
obj.rels_ext
|
@@ -17,8 +17,9 @@ module ActiveFedora
|
|
17
17
|
@datastreams = {}
|
18
18
|
|
19
19
|
dsids = @solr_doc.keys.collect { |k| k.scan(/^(.+)_dsProfile_/).flatten.first }.compact.uniq
|
20
|
-
missing = dsids-klass.ds_specs.keys
|
20
|
+
missing = dsids - klass.ds_specs.keys
|
21
21
|
missing.each do |dsid|
|
22
|
+
#Initialize the datastreams that are in the solr document, but not found in the classes spec.
|
22
23
|
mime_key = ActiveFedora::SolrService.solr_name("#{dsid}_dsProfile_dsMIME",:symbol)
|
23
24
|
mime_type = Array(@solr_doc[mime_key]).first
|
24
25
|
ds_class = mime_type =~ /[\/\+]xml$/ ? NokogiriDatastream : Datastream
|
@@ -63,5 +63,11 @@ describe ActiveFedora::Model do
|
|
63
63
|
subject { ActiveFedora::Base.load_instance_from_solr('hydrangea:fixture_mods_article1') }
|
64
64
|
it { should be_instance_of HydrangeaArticle}
|
65
65
|
end
|
66
|
+
describe "with metadata datastrem spec" do
|
67
|
+
subject { ActiveFedora::Base.load_instance_from_solr('hydrangea:fixture_mods_article1') }
|
68
|
+
it "should create an xml datastream" do
|
69
|
+
subject.datastreams['properties'].should be_kind_of ActiveFedora::MetadataDatastream
|
70
|
+
end
|
71
|
+
end
|
66
72
|
end
|
67
73
|
end
|
@@ -9,5 +9,6 @@ class HydrangeaArticle < ActiveFedora::Base
|
|
9
9
|
|
10
10
|
has_metadata :name => "descMetadata", :type=> Hydra::ModsArticleDatastream
|
11
11
|
has_metadata :name => "rightsMetadata", :type => Hydra::RightsMetadataDatastream
|
12
|
+
has_metadata :name => "properties", :type => ActiveFedora::MetadataDatastream
|
12
13
|
|
13
14
|
end
|
@@ -1,18 +1,37 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActiveFedora::SolrDigitalObject do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
describe "repository" do
|
5
|
+
subject { ActiveFedora::SolrDigitalObject.new({}) }
|
6
|
+
describe "when not finished" do
|
7
|
+
it "should not respond_to? :repository" do
|
8
|
+
subject.should_not respond_to :repository
|
9
|
+
end
|
8
10
|
end
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
describe "when finished" do
|
12
|
+
before do
|
13
|
+
subject.freeze
|
14
|
+
end
|
15
|
+
it "should respond_to? :repository" do
|
16
|
+
subject.should respond_to :repository
|
17
|
+
end
|
13
18
|
end
|
14
|
-
|
15
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "initializing" do
|
22
|
+
describe "without a datastream in the ds spec and an xml mime type in the solr doc" do
|
23
|
+
before do
|
24
|
+
class WithoutMetadataDs < ActiveFedora::Base
|
25
|
+
## No datastreams are defined in this class
|
26
|
+
end
|
27
|
+
end
|
28
|
+
after do
|
29
|
+
Object.send(:remove_const, :WithoutMetadataDs)
|
30
|
+
end
|
31
|
+
subject { ActiveFedora::SolrDigitalObject.new({'properties_dsProfile_dsMIME_s' =>'text/xml'}, WithoutMetadataDs) }
|
32
|
+
it "should create an xml datastream" do
|
33
|
+
subject.datastreams['properties'].should be_kind_of ActiveFedora::NokogiriDatastream
|
34
|
+
end
|
16
35
|
end
|
17
36
|
end
|
18
37
|
|
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: 15424139
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 4.0.0.
|
11
|
+
- 15
|
12
|
+
version: 4.0.0.rc15
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Matt Zumwalt
|