om 1.6.1 → 1.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -215,6 +215,27 @@ describe "OM::XML::TermValueOperators" do
215
215
  @article.term_values(:journal, :title_info).should == ['mork']
216
216
  end
217
217
 
218
+ describe "delete_on_update?" do
219
+
220
+ before(:each) do
221
+ att= {[:journal, :title_info]=>{"0"=>"york", "1"=>"mangle","2"=>"mork"}}
222
+ @article.update_values(att)
223
+ @article.term_values(:journal, :title_info).should == ['york', 'mangle', 'mork']
224
+ end
225
+
226
+ it "by default, setting to empty string deletes the node" do
227
+ @article.update_values({[:journal, :title_info]=>{"1"=>""}})
228
+ @article.term_values(:journal, :title_info).should == ['york', 'mork']
229
+ end
230
+
231
+ it "if delete_on_update? returns false, setting to empty string won't delete node" do
232
+ @article.stubs('delete_on_update?').returns(false)
233
+ @article.update_values({[:journal, :title_info]=>{"1"=>""}})
234
+ @article.term_values(:journal, :title_info).should == ['york', '', 'mork']
235
+ end
236
+
237
+ end
238
+
218
239
  it "should retain other child nodes when updating a text content term and shoud not append an additional text node but update text in place" do
219
240
  @article.term_values(:name,:name_content).should == ["Describes a person"]
220
241
  @article.update_values({[:name, :name_content]=>"Test text"})
@@ -259,7 +280,6 @@ describe "OM::XML::TermValueOperators" do
259
280
  it "should support adding attribute values" do
260
281
  pointer = [{:title_info=>0}, :language]
261
282
  test_val = "language value"
262
- debugger
263
283
  @article.term_values_append(
264
284
  :parent_select => [{:title_info=>0}],
265
285
  :parent_index => 0,
@@ -71,11 +71,13 @@ describe "OM::XML::Terminology::Builder" do
71
71
  t.main_title(:path=>"title", :label=>"title")
72
72
  t.language(:path=>{:attribute=>"lang"})
73
73
  }
74
- t.title(:proxy=>[:title_info, :main_title])
74
+ t.title(:proxy=>[:title_info, :main_title], :index_as =>[:facetable, :not_searchable])
75
75
  end
76
76
 
77
77
  terminology = t_builder.build
78
78
  terminology.retrieve_term(:title).should be_kind_of OM::XML::NamedTermProxy
79
+ terminology.retrieve_term(:title).index_as.should == [:facetable, :not_searchable]
80
+ terminology.retrieve_term(:title_info, :main_title).index_as.should == []
79
81
  terminology.xpath_for(:title).should == '//oxns:titleInfo/oxns:title'
80
82
  terminology.xpath_with_indexes({:title=>0}).should == "//oxns:titleInfo/oxns:title"
81
83
  # @builder_with_block.build.xpath_for_pointer(:issue).should == '//oxns:part'
@@ -319,10 +319,16 @@ describe "OM::XML::Terminology" do
319
319
  @test_full_terminology.xml_builder_template(:person,:person_id).should == 'xml.namePart( \'#{builder_new_value}\' )'
320
320
  @test_full_terminology.xml_builder_template(:name,:affiliation).should == 'xml.affiliation( \'#{builder_new_value}\' )'
321
321
  end
322
+
322
323
  it "should accept extra options" do
323
- marcrelator_role_xml_builder_template = 'xml.roleTerm( \'#{builder_new_value}\', \'type\'=>\'code\', \'authority\'=>\'marcrelator\' )'
324
- @test_full_terminology.xml_builder_template(:role, :code, {:attributes=>{"authority"=>"marcrelator"}} ).should == marcrelator_role_xml_builder_template
325
- @test_full_terminology.xml_builder_template(:person, :role, :code, {:attributes=>{"authority"=>"marcrelator"}} ).should == marcrelator_role_xml_builder_template
324
+ # Expected marcrelator_role_xml_builder_template.
325
+ # Include both version to handle either ordering of the hash -- a band-aid hack to fix failing test.
326
+ e1 = %q{xml.roleTerm( '#{builder_new_value}', 'type'=>'code', 'authority'=>'marcrelator' )}
327
+ e2 = %q{xml.roleTerm( '#{builder_new_value}', 'authority'=>'marcrelator', 'type'=>'code' )}
328
+ got = @test_full_terminology.xml_builder_template(:role, :code, {:attributes=>{"authority"=>"marcrelator"}} )
329
+ [e1, e2].should include(got)
330
+ got = @test_full_terminology.xml_builder_template(:person, :role, :code, {:attributes=>{"authority"=>"marcrelator"}} )
331
+ [e1, e2].should include(got)
326
332
  end
327
333
 
328
334
  it "should work with deeply nested properties" do
metadata CHANGED
@@ -1,16 +1,48 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: om
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
5
- prerelease:
4
+ version: 1.7.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matt Zumwalt
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: activemodel
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
14
46
  - !ruby/object:Gem::Dependency
15
47
  name: nokogiri
16
48
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +107,22 @@ dependencies:
75
107
  - - ! '>='
76
108
  - !ruby/object:Gem::Version
77
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: awesome_print
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
78
126
  - !ruby/object:Gem::Dependency
79
127
  name: mocha
80
128
  requirement: !ruby/object:Gem::Requirement
@@ -135,6 +183,7 @@ files:
135
183
  - Rakefile
136
184
  - UPDATING_DOCUMENTS.textile
137
185
  - container_spec.rb
186
+ - devel/notes.txt
138
187
  - lib/om.rb
139
188
  - lib/om/samples.rb
140
189
  - lib/om/samples/mods_article.rb
@@ -168,6 +217,7 @@ files:
168
217
  - spec/integration/querying_documents_spec.rb
169
218
  - spec/integration/rights_metadata_integration_example_spec.rb
170
219
  - spec/integration/selective_querying_spec.rb
220
+ - spec/integration/serialization_spec.rb
171
221
  - spec/integration/set_reentrant_terminology_spec.rb
172
222
  - spec/integration/xpathy_stuff_spec.rb
173
223
  - spec/spec.opts
@@ -204,12 +254,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
254
  required_rubygems_version: !ruby/object:Gem::Requirement
205
255
  none: false
206
256
  requirements:
207
- - - ! '>='
257
+ - - ! '>'
208
258
  - !ruby/object:Gem::Version
209
- version: '0'
259
+ version: 1.3.1
210
260
  requirements: []
211
261
  rubyforge_project:
212
- rubygems_version: 1.8.21
262
+ rubygems_version: 1.8.24
213
263
  signing_key:
214
264
  specification_version: 3
215
265
  summary: ! 'OM (Opinionated Metadata): A library to help you tame sprawling XML schemas
@@ -228,6 +278,7 @@ test_files:
228
278
  - spec/integration/querying_documents_spec.rb
229
279
  - spec/integration/rights_metadata_integration_example_spec.rb
230
280
  - spec/integration/selective_querying_spec.rb
281
+ - spec/integration/serialization_spec.rb
231
282
  - spec/integration/set_reentrant_terminology_spec.rb
232
283
  - spec/integration/xpathy_stuff_spec.rb
233
284
  - spec/spec.opts