active-fedora 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,90 @@
1
+ <mods version="3.0" xsi:schemaLocation="http://www.loc.gov/mods/v3
2
+ http://www.loc.gov/standards/mods/v3/mods-3-0.xsd" xmlns="http://www.loc.gov/mods/v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+
4
+ <titleInfo>
5
+ <nonSort>THE</nonSort>
6
+ <title>ARTICLE TITLE HYDRANGEA ARTICLE 1</title>
7
+ <subTitle>SUBTITLE</subTitle>
8
+ </titleInfo>
9
+ <titleInfo lang="finnish">
10
+ <title>Artikkelin otsikko Hydrangea artiklan 1</title>
11
+ </titleInfo>
12
+
13
+ <name type="personal">
14
+ <namePart type="family">FAMILY NAME</namePart>
15
+ <namePart type="given">GIVEN NAMES</namePart>
16
+ <namePart type="termsOfAddress">DR.</namePart>
17
+ <displayForm>NAME AS IT APPEARS</displayForm>
18
+ <affiliation>FACULTY, UNIVERSITY</affiliation>
19
+ <role>
20
+ <roleTerm authority="marcrelator" type="text">creator</roleTerm>
21
+ </role>
22
+ <role>
23
+ <roleTerm type="text">submitter</roleTerm>
24
+ </role>
25
+ </name>
26
+
27
+ <name type="personal">
28
+ <namePart type="family">Gautama</namePart>
29
+ <namePart type="given">Siddartha</namePart>
30
+ <namePart type="termsOfAddress">Prince</namePart>
31
+ <affiliation>Nirvana</affiliation>
32
+ <role>
33
+ <roleTerm authority="marcrelator" type="text">teacher</roleTerm>
34
+ </role>
35
+ </name>
36
+
37
+ <typeOfResource>text</typeOfResource>
38
+ <genre authority="local">journal article</genre>
39
+
40
+ <abstract>ABSTRACT</abstract>
41
+ <subject>
42
+ <topic>TOPIC 1</topic>
43
+ <topic>TOPIC 2</topic>
44
+ </subject>
45
+ <subject authority="AUTHORITY SOURCE (RFCD, LCSH)">
46
+ <topic>CONTROLLED TERM</topic>
47
+ </subject>
48
+
49
+ <language>
50
+ <languageTerm authority="iso639-2b" type="code">en-aus </languageTerm>
51
+ </language>
52
+
53
+ <physicalDescription>
54
+ <internetMediaType>application/pdf</internetMediaType>
55
+ <extent>36 p.</extent>
56
+ </physicalDescription>
57
+
58
+ <relatedItem type="host">
59
+ <titleInfo>
60
+ <title>TITLE OF HOST JOURNAL</title>
61
+ </titleInfo>
62
+ <originInfo>
63
+ <publisher>PUBLISHER</publisher>
64
+ <dateIssued>DATE</dateIssued>
65
+ </originInfo>
66
+ <identifier type="issn">0013-8908</identifier>
67
+ <part>
68
+ <detail type="volume">
69
+ <number>2</number>
70
+ </detail>
71
+ <detail type="level">
72
+ <number>2</number>
73
+ </detail>
74
+ <extent unit="pages">
75
+ <start>195</start>
76
+ <end>230</end>
77
+ </extent>
78
+ <date>FEB. 2007</date>
79
+ </part>
80
+ </relatedItem>
81
+
82
+ <identifier type="uri">http://URL.edu.au/</identifier>
83
+ <identifier type="doi">doi:10.1006/jmbi.1995.0238</identifier>
84
+ <location>
85
+ <url>http://URL.edu.au/</url>
86
+ </location>
87
+ <accessCondition type="restrictionOnAccess">EMBARGO NOTE</accessCondition>
88
+ <accessCondition type="use and reproduction">OPEN ACCESS</accessCondition>
89
+
90
+ </mods>
@@ -1,6 +1,7 @@
1
1
  require File.join( File.dirname(__FILE__), "../spec_helper" )
2
2
 
3
3
  require 'rexml/document'
4
+ require "hydra"
4
5
 
5
6
  include ActiveFedora
6
7
 
@@ -30,6 +31,12 @@ describe ActiveFedora::Base do
30
31
  m.field "location", :string
31
32
  end
32
33
 
34
+ # has_metadata :name=>"arbitrary_xml", :type=> ActiveFedora::NokogiriDatastream do |m|
35
+ # m.root_property :myxml, "my_xml", "http://www.example.gov/schema/v3"
36
+ # end
37
+
38
+ has_metadata :name=>"mods_article", :type=> Hydra::ModsArticle
39
+
33
40
  has_metadata :name => "dublin_core", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
34
41
  # Default :multiple => true
35
42
  #
@@ -47,6 +47,10 @@ require File.join( File.dirname(__FILE__), "../spec_helper" )
47
47
  # curl -i http://localhost:8080/fedora/objects/nextPID.xml -u fedoraAdmin:fedoraAdmin
48
48
 
49
49
  describe Fedora::Repository, "constructor" do
50
+ after(:all) do
51
+ Fedora::Repository.register(ActiveFedora.fedora_config[:url])
52
+ end
53
+
50
54
  it "should accept URL as string" do
51
55
  fedora_url = "http://fedoraAdmin:fedoraAdmin@127.0.0.1:8080/fedora"
52
56
  repository = Fedora::Repository.register(fedora_url)
@@ -1,6 +1,5 @@
1
1
  require File.join( File.dirname(__FILE__), "../spec_helper" )
2
2
 
3
-
4
3
  describe ActiveFedora::NokogiriDatastream do
5
4
 
6
5
  before(:all) do
@@ -15,7 +14,7 @@ describe ActiveFedora::NokogiriDatastream do
15
14
  end
16
15
 
17
16
  before(:each) do
18
- @test_ds = ActiveFedora::NokogiriDatastream.new
17
+ @test_ds = ActiveFedora::NokogiriDatastream.new(:blob=>"<test_xml/>")
19
18
  end
20
19
 
21
20
  after(:each) do
@@ -26,6 +25,24 @@ describe ActiveFedora::NokogiriDatastream do
26
25
  ActiveFedora::NokogiriDatastream.should respond_to(:new)
27
26
  @test_ds.ng_xml.should be_instance_of(Nokogiri::XML::Document)
28
27
  end
28
+ it 'should load xml from blob if provided' do
29
+ test_ds1 = ActiveFedora::NokogiriDatastream.new(:blob=>"<xml><foo/></xml>")
30
+ test_ds1.ng_xml.to_xml.should == "<?xml version=\"1.0\"?>\n<xml>\n <foo/>\n</xml>\n"
31
+ end
32
+ end
33
+
34
+ describe '#from_xml' do
35
+ it "should work when a template datastream is passed in" do
36
+ mods_xml = Nokogiri::XML::Document.parse( fixture(File.join("mods_articles", "hydrangea_article1.xml")) )
37
+ tmpl = Hydra::ModsArticle.new
38
+ Hydra::ModsArticle.from_xml(mods_xml,tmpl).ng_xml.root.to_xml.should == mods_xml.root.to_xml
39
+ end
40
+ it "should work when foxml datastream xml is passed in" do
41
+ pending "at least for now, just updated Base.deserialize to feed in the xml content rather than the foxml datstream xml. Possibly we can update MetadataDatstream to assume the same and leave it at that? -MZ 23-06-2010"
42
+ hydrangea_article_foxml = Nokogiri::XML::Document.parse( fixture("hydrangea_fixture_mods_article1.foxml.xml") )
43
+ ds_xml = hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']")
44
+ Hydra::ModsArticle.from_xml(ds_xml).ng_xml.to_xml.should == hydrangea_article_foxml.at_xpath("//foxml:datastream[@ID='descMetadata']/foxml:datastreamVersion[last()]/foxml:xmlContent").first_element_child.to_xml
45
+ end
29
46
  end
30
47
 
31
48
 
@@ -49,33 +66,35 @@ describe ActiveFedora::NokogiriDatastream do
49
66
  it "should provide .to_xml" do
50
67
  @test_ds.should respond_to(:to_xml)
51
68
  end
52
- it 'should output the fields hash as XML' do
53
- @test_ds.expects(:fields).returns(@sample_fields)
54
- returned_xml = XmlSimple.xml_in(@test_ds.to_xml)
55
- returned_xml.should == @sample_xml
69
+
70
+ it "should ng_xml.to_xml" do
71
+ @test_ds.ng_xml.expects(:to_xml).returns("xml")
72
+ @test_ds.to_xml.should == "xml"
56
73
  end
57
74
 
58
- it 'should accept an optional REXML Document as an argument and insert its fields into that' do
59
- @test_ds.expects(:fields).returns(@sample_fields)
60
- rexml = REXML::Document.new("<test_rexml/>")
61
- rexml.root.elements.expects(:add).times(5)
62
- result = @test_ds.to_xml(rexml)
75
+ it 'should accept an optional Nokogiri::XML Document as an argument and insert its fields into that (mocked test)' do
76
+ doc = Nokogiri::XML::Document.parse("<test_document/>")
77
+ doc.root.expects(:add_child).with(@test_ds.ng_xml.root)
78
+ @test_ds.to_xml(doc)
63
79
  end
64
- it 'should accept an optional REXML Document as an argument and insert its fields into that' do
65
- @test_ds.expects(:fields).returns(@sample_fields)
66
- rexml = REXML::Document.new("<test_rexml/>")
67
- result = @test_ds.to_xml(rexml)
68
- XmlSimple.xml_in(rexml.to_s).should == @sample_xml
69
- XmlSimple.xml_in(result).should == @sample_xml
80
+
81
+ it 'should accept an optional Nokogiri::XML Document as an argument and insert its fields into that (functional test)' do
82
+ expected_result = XmlSimple.xml_in("<test_document><foo/><test_xml/></test_document>")
83
+ doc = Nokogiri::XML::Document.parse("<test_document><foo/></test_document>")
84
+ result = @test_ds.to_xml(doc)
85
+ XmlSimple.xml_in(doc.to_s).should == expected_result
86
+ XmlSimple.xml_in(result).should == expected_result
70
87
  end
71
88
 
72
- it 'should add to root of REXML::Documents, but add directly to the elements if a REXML::Element is passed in' do
73
- @test_ds.expects(:fields).returns(@sample_fields).times(2)
74
- doc = REXML::Document.new("<test_document/>")
75
- el = REXML::Element.new("<test_element/>")
76
- doc.root.elements.expects(:add).times(5)
77
- el.expects(:add).times(5)
78
- @test_ds.to_xml(doc)
89
+ it 'should add to root of Nokogiri::XML::Documents, but add directly to the elements if a Nokogiri::XML::Node is passed in' do
90
+ mock_new_node = mock("new node")
91
+ mock_new_node.stubs(:to_xml).returns("foo")
92
+
93
+ doc = Nokogiri::XML::Document.parse("<test_document/>")
94
+ el = Nokogiri::XML::Node.new("test_element", Nokogiri::XML::Document.new)
95
+ doc.root.expects(:add_child).with(@test_ds.ng_xml.root).returns(mock_new_node)
96
+ el.expects(:add_child).with(@test_ds.ng_xml.root).returns(mock_new_node)
97
+ @test_ds.to_xml(doc).should
79
98
  @test_ds.to_xml(el)
80
99
  end
81
100
 
@@ -92,118 +111,6 @@ describe ActiveFedora::NokogiriDatastream do
92
111
  end
93
112
  end
94
113
 
95
- describe '#field' do
96
-
97
- before(:each) do
98
- class SpecDatastream < ActiveFedora::MetadataDatastream
99
- def initialize
100
- super
101
- field :publisher, :string
102
- field :coverage, :text
103
- field :creation_date, :date
104
- field :mydate, :date
105
- field :mycomplicated_field, :string, :multiple=>false, :encoding=>'LCSH', :element_attrs=>{:foo=>:bar, :baz=>:bat}
106
- end
107
- end
108
- end
109
-
110
- after(:each) do
111
- Object.send(:remove_const, :SpecDatastream)
112
- end
113
-
114
-
115
- describe ".values" do
116
- it "should call ng_xml.values_for(field_name) OR call corresponding lookup method and build an array of values by calling .value on each node in the set"
117
- end
118
-
119
- describe ".values<<" do
120
- it "should call corresponding builder method"
121
- end
122
-
123
- describe ".values=" do
124
- it "should wipe out any existing nodes, use the corresponding builder, and insert new node(s) as the replacement"
125
- end
126
-
127
- it 'should add corresponding field to the @fields hash and set the field :type ' do
128
- sds = SpecDatastream.new
129
- sds.fields.should_not have_key(:bio)
130
- sds.field :bio, :text
131
- sds.fields.should have_key(:bio)
132
- sds.fields[:bio].should have_key(:type)
133
- sds.fields[:bio][:type].should == :text
134
- sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
135
- end
136
-
137
- # it "should insert custom element attrs into the xml stream" do
138
- # sds = SpecDatastream.new
139
- # sds.mycomplicated_field_values='foo'
140
- # sds.fields[:mycomplicated_field][:element_attrs].should == {:foo=>:bar, :baz=>:bat}
141
- # sds.to_xml.should == '<fields><mycomplicated_field baz=\'bat\' foo=\'bar\'>foo</mycomplicated_field></fields>'
142
- # end
143
-
144
- it "should add getters and setters and appenders with field name" do
145
- local_test_ds = SpecDatastream.new
146
- local_test_ds.should respond_to(:publisher_values)
147
- local_test_ds.should respond_to(:publisher_append)
148
- local_test_ds.should respond_to(:publisher_values=)
149
- local_test_ds.publisher_values.class.should == Array
150
- local_test_ds.should respond_to(:coverage_values)
151
- local_test_ds.should respond_to(:coverage_values=)
152
- local_test_ds.should respond_to(:coverage_append)
153
- local_test_ds.should respond_to(:creation_date_values)
154
- local_test_ds.should respond_to(:creation_date_append)
155
- local_test_ds.should respond_to(:creation_date_values=)
156
- local_test_ds.should respond_to(:mydate_values)
157
- local_test_ds.should respond_to(:mydate_append)
158
- local_test_ds.should respond_to(:mydate_values=)
159
- end
160
-
161
- it "should track field values at instance level, not at class level" do
162
- local_test_ds1 = SpecDatastream.new
163
- local_test_ds2 = SpecDatastream.new
164
- local_test_ds1.publisher_values = ["publisher1", "publisher2"]
165
- local_test_ds2.publisher_values = ["publisherA", "publisherB"]
166
-
167
- local_test_ds2.publisher_values.should == ["publisherA", "publisherB"]
168
- local_test_ds1.publisher_values.should == ["publisher1", "publisher2"]
169
- end
170
-
171
- it "should allow you to add field values using <<" do
172
- local_test_ds1 = SpecDatastream.new
173
- local_test_ds1.publisher_values << "publisher1"
174
- local_test_ds1.publisher_values.should == ["publisher1"]
175
- end
176
-
177
- it "should create setter that always turns non-arrays into arrays" do
178
- local_test_ds = SpecDatastream.new
179
- local_test_ds.publisher_values = "Foo"
180
- local_test_ds.publisher_values.should == ["Foo"]
181
- end
182
-
183
- it "should create setter that sets datastream.dirty? to true" do
184
- local_test_ds = SpecDatastream.new
185
- local_test_ds.should_not be_dirty
186
- local_test_ds.publisher_values = "Foo"
187
- local_test_ds.should be_dirty
188
-
189
- # Note: If you use << to append values, the datastream will not be marked as dirty!
190
- #local_test_ds.dirty = false
191
-
192
- #local_test_ds.should_not be_dirty
193
- #local_test_ds.publisher_values << "Foo"
194
- #local_test_ds.should be_dirty
195
- end
196
-
197
- it "should add any extra opts to the field hash" do
198
- local_test_ds = SpecDatastream.new
199
- local_test_ds.field "myfield", :string, :foo => "foo", :bar => "bar"
200
- local_test_ds.fields[:myfield].should have_key(:foo)
201
- local_test_ds.fields[:myfield][:foo].should == "foo"
202
- local_test_ds.fields[:myfield].should have_key(:bar)
203
- local_test_ds.fields[:myfield][:bar].should == "bar"
204
- end
205
-
206
- end
207
114
 
208
115
  describe ".to_solr" do
209
116
 
@@ -212,7 +119,15 @@ describe ActiveFedora::NokogiriDatastream do
212
119
  ActiveFedora::SolrService.load_mappings
213
120
  end
214
121
 
215
- it "should iterate through the class fields, calling .values on each and appending the values to the solr doc"
122
+ it "should iterate through the class accessors, calling .solrize_accessor on each and passing in the solr doc" do
123
+ mock_accessors = {:accessor1=>:accessor1_info, :accessor2=>:accessor2_info}
124
+ ActiveFedora::NokogiriDatastream.stubs(:accessors).returns(mock_accessors)
125
+ doc = Solr::Document.new
126
+ mock_accessors.each_pair do |k,v|
127
+ @test_ds.expects(:solrize_accessor).with(k, v, :solr_doc=>doc)
128
+ end
129
+ @test_ds.to_solr(doc)
130
+ end
216
131
 
217
132
  it "should provide .to_solr and return a SolrDocument" do
218
133
  @test_ds.should respond_to(:to_solr)
@@ -224,76 +139,101 @@ describe ActiveFedora::NokogiriDatastream do
224
139
  @test_ds.to_solr(doc).should equal(doc)
225
140
  end
226
141
 
227
- it "should iterate through @fields hash" do
228
- @test_ds.expects(:fields).returns(@sample_fields)
229
- solr_doc = @test_ds.to_solr
230
-
231
- solr_doc[:publisher_t].should == "publisher1"
232
- solr_doc[:coverage_t].should == "coverage1"
233
- solr_doc[:creation_date_dt].should == "fake-date"
234
- solr_doc[:mydate_dt].should == "fake-date"
235
-
236
- solr_doc[:empty_field_t].should be_nil
142
+ end
143
+
144
+ describe ".solrize_accessor" do
145
+ before(:all) do
146
+ class AccessorizedDs < ActiveFedora::NokogiriDatastream
147
+
148
+ root_property :mods, "mods", "http://www.loc.gov/mods/v3", :attributes=>["id", "version"], :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-2.xsd"
149
+
150
+ accessor :title_info, :relative_xpath=>'oxns:titleInfo', :children=>[
151
+ {:main_title=>{:relative_xpath=>'oxns:title'}},
152
+ {:language =>{:relative_xpath=>{:attribute=>"lang"} }}
153
+ ]
154
+ accessor :abstract
155
+ accessor :topic_tag, :relative_xpath=>'oxns:subject/oxns:topic'
156
+ accessor :person, :relative_xpath=>'oxns:name[@type="personal"]', :children=>[
157
+ {:last_name=>{:relative_xpath=>'oxns:namePart[@type="family"]'}},
158
+ {:first_name=>{:relative_xpath=>'oxns:namePart[@type="given"]'}},
159
+ {:institution=>{:relative_xpath=>'oxns:affiliation'}},
160
+ {:role=>{:children=>[
161
+ {:text=>{:relative_xpath=>'oxns:roleTerm[@type="text"]'}},
162
+ {:code=>{:relative_xpath=>'oxns:roleTerm[@type="code"]'}}
163
+ ]}}
164
+ ]
165
+ end
237
166
  end
238
167
 
239
- it "should allow multiple values for a single field"
168
+ before(:each) do
169
+ file = fixture(File.join("mods_articles", "hydrangea_article1.xml"))
170
+ @accessorized_ds = AccessorizedDs.new(:blob=>file)
171
+ end
240
172
 
241
- it 'should append create keys in format field_name + _ + field_type' do
242
- @test_ds.stubs(:fields).returns(@sample_fields)
173
+ it "should perform a lookup and iterate over nodes in the result set calling solrize_node then calling solrize_accessor on any of the children, adding accessor_name & node index to parents array" do
174
+ mock_title_info_set = ["TI1", "TI2"]
175
+ mock_main_title_set = ["main title"]
176
+ mock_language_set = ["language"]
243
177
 
244
- #should have these
245
-
246
- @test_ds.to_solr[:publisher_t].should_not be_nil
247
- @test_ds.to_solr[:coverage_t].should_not be_nil
248
- @test_ds.to_solr[:creation_date_dt].should_not be_nil
178
+ solr_doc = Solr::Document.new
249
179
 
250
- #should NOT have these
251
- @test_ds.to_solr[:narrator].should be_nil
252
- @test_ds.to_solr[:title].should be_nil
253
- @test_ds.to_solr[:empty_field].should be_nil
180
+ AccessorizedDs.expects(:accessor_xpath).with( :title_info ).returns("title_info_xpath")
181
+ @accessorized_ds.expects(:lookup).with( "title_info_xpath" ).returns(mock_title_info_set)
254
182
 
255
- end
256
-
257
- it "should use Solr mappings to generate field names" do
258
- ActiveFedora::SolrService.load_mappings(File.join(File.dirname(__FILE__), "..", "..", "config", "solr_mappings_af_0.1.yml"))
259
- @test_ds.stubs(:fields).returns(@sample_fields)
260
- solr_doc = @test_ds.to_solr
261
-
262
- #should have these
263
-
264
- solr_doc[:publisher_field].should == "publisher1"
265
- solr_doc[:coverage_field].should == "coverage1"
266
- solr_doc[:creation_date_date].should == "fake-date"
267
- solr_doc[:mydate_date].should == "fake-date"
183
+ mock_title_info_set.each do |tin|
184
+ node_index = mock_title_info_set.index(tin)
185
+ @accessorized_ds.expects(:solrize_node).with(tin, [:title_info], solr_doc)
186
+
187
+ # Couldn't mock the recursive calls to solrize_accessor without preventing the initial one, so was forced to mock out the whole recursive stack.
188
+ # @accessorized_ds.expects(:solrize_accessor).with(:main_title, AccessorizedDs.accessors[:title_info][:children][:main_title], :parents=>[{:title_info=>node_index}])
189
+ # @accessorized_ds.expects(:solrize_accessor).with(:language, AccessorizedDs.accessors[:title_info][:children][:language], :parents=>[{:title_info=>node_index}])
190
+ AccessorizedDs.expects(:accessor_xpath).with( {:title_info=>node_index}, :main_title ).returns("title_info_main_title_xpath")
191
+ AccessorizedDs.expects(:accessor_xpath).with( {:title_info=>node_index}, :language ).returns("title_info_language_xpath")
192
+ @accessorized_ds.expects(:lookup).with( "title_info_main_title_xpath" ).returns(mock_main_title_set)
193
+ @accessorized_ds.expects(:lookup).with( "title_info_language_xpath" ).returns(mock_language_set)
194
+ @accessorized_ds.expects(:solrize_node).with("main title", [{:title_info=>node_index}, :main_title], solr_doc)
195
+ @accessorized_ds.expects(:solrize_node).with("language", [{:title_info=>node_index}, :language], solr_doc)
196
+ end
268
197
 
269
- solr_doc[:publisher_t].should be_nil
270
- solr_doc[:coverage_t].should be_nil
271
- solr_doc[:creation_date_dt].should be_nil
198
+ @accessorized_ds.solrize_accessor(:title_info, AccessorizedDs.accessors[:title_info], :solr_doc=>solr_doc)
272
199
 
273
- # Reload default mappings
274
- ActiveFedora::SolrService.load_mappings
275
200
  end
276
201
 
277
- it 'should append _dt to dates' do
278
- @test_ds.expects(:fields).returns(@sample_fields).at_least_once
202
+ it "should not call solrize_accessor once it reaches an accessor with no children accessors set" do
203
+ pending "not sure how to test for this"
204
+ @accessorized_ds.solrize_accessor(:text, AccessorizedDs.accessor_info( [{:person=>1}, :last_name] ), :parents=>[{:person=>1}])
205
+ end
206
+
207
+ it "should use values form parents array when requesting accessor_xpath and when generating solr field names" do
208
+ parents_array = [{:person=>0}, {:role=>1}]
209
+ AccessorizedDs.accessors[:person][:children][:role][:children][:text]
279
210
 
211
+ # This should catch the "submitter" roleTerm from the second role node within the first person node and put it into a solr field called "person_0_role_2_text_0_t" and a solr field called "person_role_text_t"
212
+ @accessorized_ds.solrize_accessor(:text, AccessorizedDs.accessor_info( *parents_array + [:text] ), :parents=>parents_array)
213
+ end
214
+
215
+ it "should use Solr mappings to generate field names" do
216
+
217
+ solr_doc = @accessorized_ds.to_solr
280
218
  #should have these
219
+
220
+ solr_doc[:abstract_t].should == "ABSTRACT"
221
+ solr_doc[:title_info_1_language_t].should == "finnish"
222
+ solr_doc[:person_1_role_0_text_t].should == "teacher"
223
+ # solr_doc[:mydate_date].should == "fake-date"
224
+ #
225
+ # solr_doc[:publisher_t].should be_nil
226
+ # solr_doc[:coverage_t].should be_nil
227
+ # solr_doc[:creation_date_dt].should be_nil
228
+ # solr_doc.should == ""
281
229
 
282
- @test_ds.to_solr[:creation_date_dt].should_not be_nil
283
- @test_ds.to_solr[:mydate_dt].should_not be_nil
284
-
285
- #should NOT have these
286
-
287
- @test_ds.to_solr[:mydate].should be_nil
288
- @test_ds.to_solr[:creation_date_date].should be_nil
289
230
  end
290
-
291
231
  end
292
232
 
293
- describe '.fields' do
294
- it "should return a Hash" do
295
- @test_ds.fields.should be_instance_of(Hash)
296
- end
233
+ describe ".solrize_node" do
234
+ it "should create a solr field containing node.text"
235
+ it "should create hierarchical field entries if parents is not empty"
236
+ it "should only create one node if parents is empty"
297
237
  end
298
238
 
299
239
  end