om 3.0.6 → 3.0.7

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: d22a3f6b7dc5a7d6c75dac4d1bf14c60f5e0fc0c
4
- data.tar.gz: 22198afe29d16339742f4ef4a9735121afa31136
3
+ metadata.gz: 3a06b8c699f06fb0cb851e7b4e66110738a00cf7
4
+ data.tar.gz: 36671447b086cdb74d25ac39cf50d35573a94c72
5
5
  SHA512:
6
- metadata.gz: a32c99b5587ae306791119c7e4e0c0b9e6d7ae7f8bb36e9ad4102c6de90c6a892daebc680083ab2609e9bf261f608f0d15d67dd66f30ec5263fc143d376f71b5
7
- data.tar.gz: 4a4cb65a378cbef9ce02f38f05309916c6703978962112a01d7a08ff51ccad389f5efd78425b43531fada607b1cb25888f04f652e568f4e020f1e006e4999886
6
+ metadata.gz: d159dd3d980dc79f7aed168c4f621941819ce89efca387b50ca34781a119da2490d07fd210e69dadd5e700cc5c8ec66cb0fa8ada329f490330dcf72137d4d0eb
7
+ data.tar.gz: c388b9688995e643be94e472e804daf31e227d69746fd65c10cfd09ab824fdf1fd4426912eba5beaaca4137066f1faae097268c8ce239553bfc661bcb22dad47
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -1,3 +1,3 @@
1
1
  module Om
2
- VERSION = "3.0.6"
2
+ VERSION = "3.0.7"
3
3
  end
@@ -84,7 +84,11 @@ module OM
84
84
  new_values.each_with_index do |z, y|
85
85
  ## If we pass something that already has an index on it, we should be able to add it.
86
86
  if existing_nodes[y.to_i].nil?
87
- parent_pointer = parent ? parent.to_pointer : nil
87
+ parent_pointer = if parent
88
+ parent.to_pointer
89
+ elsif term.is_a? NamedTermProxy
90
+ term.proxy_pointer[0..-2]
91
+ end
88
92
  @document.term_values_append(:parent_select=> parent_pointer,:parent_index=>0,:template=>to_pointer,:values=>z)
89
93
  else
90
94
  @document.term_value_update(xpath, y.to_i, z)
@@ -33,49 +33,57 @@ describe "an example with :proxy and :ref" do
33
33
  t.image_size(:proxy=>[:image, :file, :size])
34
34
  t.image_md5(:proxy=>[:image, :file, :md5])
35
35
  t.image_sha1(:proxy=>[:image, :file, :sha1])
36
- end
36
+ end
37
37
  end
38
38
  end
39
39
 
40
- subject do
41
- ExampleProxyAndRefTerminology.from_xml <<-EOF
42
- <outer outerId="hypatia:outer" type="outer type">
43
- <resource type="ead" id="coll.ead" objectId="hypatia:ead_file_asset_fixture">
44
- <file id="my_ead.xml" format="XML" mimetype="text/xml" size="47570">
45
- <checksum type="md5">123</checksum>
46
- <checksum type="sha1">456</checksum>
47
- </file>
48
- </resource>
49
- <resource type="image" id="image" objectId="hypatia:coll_img_file_asset_fixture">
50
- <file id="my_image.jpg" format="JPG" mimetype="image/jpeg" size="302080">
51
- <checksum type="md5">789</checksum>
52
- <checksum type="sha1">666</checksum>
53
- </file>
54
- </resource>
55
- </outer>
40
+ context 'with empty content' do
41
+ subject { ExampleProxyAndRefTerminology.from_xml "<outer/>" }
42
+ it "should build the parent nodes when setting a proxy term" do
43
+ subject.image_sha1 = '123'
44
+ expect(subject.ng_xml).to be_equivalent_to "<outer><resource type=\"image\"><file><checksum type=\"sha1\">123</checksum></file></resource></outer>"
45
+ end
46
+ end
56
47
 
57
- EOF
58
- end
48
+ context "with existing content" do
49
+ subject do
50
+ ExampleProxyAndRefTerminology.from_xml <<-EOF
51
+ <outer outerId="hypatia:outer" type="outer type">
52
+ <resource type="ead" id="coll.ead" objectId="hypatia:ead_file_asset_fixture">
53
+ <file id="my_ead.xml" format="XML" mimetype="text/xml" size="47570">
54
+ <checksum type="md5">123</checksum>
55
+ <checksum type="sha1">456</checksum>
56
+ </file>
57
+ </resource>
58
+ <resource type="image" id="image" objectId="hypatia:coll_img_file_asset_fixture">
59
+ <file id="my_image.jpg" format="JPG" mimetype="image/jpeg" size="302080">
60
+ <checksum type="md5">789</checksum>
61
+ <checksum type="sha1">666</checksum>
62
+ </file>
63
+ </resource>
64
+ </outer>
59
65
 
60
- describe "image" do
61
- it "should have the right proxy terms" do
62
- subject.ead_fedora_pid.should include "hypatia:ead_file_asset_fixture"
63
- subject.ead_ds_label.should include "my_ead.xml"
64
- subject.ead_size.should include "47570"
65
- subject.ead_md5.should include "123"
66
- subject.ead_sha1.should include "456"
67
- end
66
+ EOF
68
67
  end
69
68
 
70
- describe "ead" do
71
- it "should have the right proxy terms" do
72
- subject.image_fedora_pid.should include "hypatia:coll_img_file_asset_fixture"
73
- subject.image_ds_label.should include "my_image.jpg"
74
- subject.image_size.should include "302080"
75
- subject.image_md5.should include "789"
76
- subject.image_sha1.should include "666"
69
+ describe "image" do
70
+ it "should have the right proxy terms" do
71
+ subject.ead_fedora_pid.should include "hypatia:ead_file_asset_fixture"
72
+ subject.ead_ds_label.should include "my_ead.xml"
73
+ subject.ead_size.should include "47570"
74
+ subject.ead_md5.should include "123"
75
+ subject.ead_sha1.should include "456"
76
+ end
77
77
  end
78
78
 
79
+ describe "ead" do
80
+ it "should have the right proxy terms" do
81
+ subject.image_fedora_pid.should include "hypatia:coll_img_file_asset_fixture"
82
+ subject.image_ds_label.should include "my_image.jpg"
83
+ subject.image_size.should include "302080"
84
+ subject.image_md5.should include "789"
85
+ subject.image_sha1.should include "666"
86
+ end
87
+ end
79
88
  end
80
-
81
89
  end
@@ -65,7 +65,7 @@ describe "OM::XML::Accessors" do
65
65
 
66
66
  describe "update_properties" do
67
67
  it "should update the declared properties" do
68
- pending "nesting is too deep..."
68
+ skip "nesting is too deep..."
69
69
  @sample.retrieve(*[:edit_access, :machine, :person]).length.should == 0
70
70
  @sample.update_properties([:edit_access, :machine, :person]=>"user id").should == {"edit_access_machine_person"=>{"-1"=>"user id"}}
71
71
  @sample.retrieve(*[:edit_access, :machine, :person]).length.should == 1
@@ -120,13 +120,13 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
120
120
  end
121
121
 
122
122
  it "should have the terms :author_given and :author_family to get the author name" do
123
- pending "This doesn't seem to work?"
123
+ skip "This doesn't seem to work?"
124
124
  subject.author_given.should include("Mary")
125
125
  subject.author_family.should include("Pickral")
126
126
  end
127
127
 
128
128
  it "should have the terms :advisor_given and :advisor_family to get the advisor name" do
129
- pending "This doesn't seem to work?"
129
+ skip "This doesn't seem to work?"
130
130
  subject.advisor_given.should include("David")
131
131
  subject.advisor_family.should include("Small")
132
132
  end
@@ -89,7 +89,7 @@ describe "OM::XML::Document" do
89
89
 
90
90
  describe ".find_by_terms_and_value" do
91
91
  it "should fail gracefully if you try to look up nodes for an undefined property" do
92
- pending "better to get an informative error?"
92
+ skip "better to get an informative error?"
93
93
  @fixturemods.find_by_terms_and_value(:nobody_home).should == []
94
94
  end
95
95
  it "should use Nokogiri to retrieve a NodeSet corresponding to the term pointers" do
@@ -123,7 +123,7 @@ describe "OM::XML::Document" do
123
123
  @mods_article.find_by_terms( {:person=>1}, :person_id).first.text.should == "123987"
124
124
  end
125
125
  it "should support accessors whose relative_xpath is a lookup array instead of an xpath string" do
126
- # pending "this only impacts scenarios where we want to display & edit"
126
+ # skip "this only impacts scenarios where we want to display & edit"
127
127
  DocumentTest.terminology.retrieve_term(:title_info, :language).path.should == {:attribute=>"lang"}
128
128
  # @sample.retrieve( :title, 1 ).first.text.should == "Artikkelin otsikko Hydrangea artiklan 1"
129
129
  @mods_article.find_by_terms( {:title_info=>1}, :language ).first.text.should == "finnish"
@@ -134,7 +134,7 @@ describe "OM::XML::Document" do
134
134
  end
135
135
 
136
136
  it "should return nil if the xpath fails to generate" do
137
- pending "Can't decide if it's better to return nil or raise an error. Choosing informative errors for now."
137
+ skip "Can't decide if it's better to return nil or raise an error. Choosing informative errors for now."
138
138
  @mods_article.find_by_terms( {:foo=>20}, :bar ).should == nil
139
139
  end
140
140
 
@@ -35,14 +35,14 @@ describe OM::XML::Term do
35
35
 
36
36
  describe 'inner_xml' do
37
37
  it "should be a kind of Nokogiri::XML::Node" do
38
- pending
38
+ skip
39
39
  @test_mapping.inner_xml.should be_kind_of(Nokogiri::XML::Node)
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#from_node' do
44
44
  it "should create a mapper from a nokogiri node" do
45
- pending "probably should do this in the Builder"
45
+ skip "probably should do this in the Builder"
46
46
  ng_builder = Nokogiri::XML::Builder.new do |xml|
47
47
  xml.mapper(:name=>"person", :path=>"name") {
48
48
  xml.attribute(:name=>"type", :value=>"personal")
@@ -87,7 +87,7 @@ describe OM::XML::Term do
87
87
 
88
88
  describe 'inner_xml' do
89
89
  it "should be a kind of Nokogiri::XML::Node" do
90
- pending
90
+ skip
91
91
  @test_name_part.inner_xml.should be_kind_of(Nokogiri::XML::Node)
92
92
  end
93
93
  end
@@ -138,13 +138,13 @@ describe "OM::XML::TermValueOperators" do
138
138
  end
139
139
 
140
140
  it "should support inserting attributes" do
141
- pending "HYDRA-415"
141
+ skip "HYDRA-415"
142
142
  @sample.update_values({['title_info', 'language']=>'Le Titre'})
143
143
  @sample.term_values('title_info', 'french_title').should == ['Le Titre']
144
144
  end
145
145
 
146
146
  it "should support inserting namespaced attributes" do
147
- pending "HYDRA-415"
147
+ skip "HYDRA-415"
148
148
  @sample.update_values({['title_info', 'main_title', 'main_title_lang']=>'eng'})
149
149
  @sample.term_values('title_info', 'main_title', 'main_title_lang').should == ['eng']
150
150
  ## After a proxy
@@ -329,7 +329,7 @@ describe "OM::XML::TermValueOperators" do
329
329
  end
330
330
 
331
331
  it "should support more complex mixing & matching" do
332
- pending "not working because builder_template is not returning the correct template (returns builder for role instead of roleTerm)"
332
+ skip "not working because builder_template is not returning the correct template (returns builder for role instead of roleTerm)"
333
333
  @sample.ng_xml.xpath('//oxns:name[@type="personal"][2]/oxns:role[1]/oxns:roleTerm', @sample.ox_namespaces).length.should == 2
334
334
  @sample.term_values_append(
335
335
  :parent_select =>'//oxns:name[@type="personal"][2]/oxns:role',
@@ -389,7 +389,7 @@ describe "OM::XML::TermValueOperators" do
389
389
  end
390
390
 
391
391
  it "should replace the existing node if you pass a template and values" do
392
- pending
392
+ skip
393
393
  @sample.term_value_update(
394
394
  :parent_select =>'//oxns:name[@type="personal"]',
395
395
  :parent_index => 1,
@@ -143,7 +143,7 @@ EOF
143
143
  end
144
144
 
145
145
  it "should support mappers with default_content_path" do
146
- pending "need to implement mapper_set first"
146
+ skip "need to implement mapper_set first"
147
147
  #@test_term_with_default_path = OM::XML::Term.new(:volume, :path=>"detail", :attributes=>{:type=>"volume"}, :default_content_path=>"number")
148
148
 
149
149
  OM::XML::TermXpathGenerator.generate_relative_xpath(@test_term_with_default_path).should == 'oxns:detail[@type="volume"]'
@@ -115,7 +115,7 @@ describe "OM::XML::Terminology::Builder" do
115
115
 
116
116
  describe '#from_xml' do
117
117
  it "should let you load mappings from an xml file" do
118
- pending
118
+ skip
119
119
  vocab = OM::XML::Terminology.from_xml( fixture("sample_mappings.xml") )
120
120
  vocab.should be_instance_of OM::XML::Terminology
121
121
  vocab.mappers.should == {}
@@ -159,7 +159,7 @@ describe "OM::XML::Terminology::Builder" do
159
159
 
160
160
  describe '.insert_term' do
161
161
  it "should create a new OM::XML::Term::Builder and insert it into the class mappings hash" do
162
- pending
162
+ skip
163
163
 
164
164
  result = @test_builder.insert_mapper(:name_, :namePart).index_as([:facetable, :searchable, :sortable, :displayable]).required(true).type(:text)
165
165
  @test_builder.mapper_builders(:name_, :namePart).should == result
@@ -179,7 +179,7 @@ describe "OM::XML::Terminology" do
179
179
 
180
180
  describe '#from_xml' do
181
181
  it "should let you load mappings from an xml file" do
182
- pending
182
+ skip
183
183
  vocab = OM::XML::Terminology.from_xml( fixture("sample_mappings.xml") )
184
184
  vocab.should be_instance_of OM::XML::Terminology
185
185
  vocab.mappers.should == {}
@@ -188,7 +188,7 @@ describe "OM::XML::Terminology" do
188
188
 
189
189
  describe '#to_xml' do
190
190
  it "should let you serialize mappings to an xml document" do
191
- pending
191
+ skip
192
192
  TerminologyTest.to_xml.should == ""
193
193
  end
194
194
  end
@@ -240,7 +240,7 @@ describe "OM::XML::Terminology" do
240
240
 
241
241
  describe ".term_xpath" do
242
242
  it "should insert calls to xpath array lookup into parent xpaths if parents argument is provided" do
243
- pending
243
+ skip
244
244
  # conference_mapper = TerminologyTest.retrieve_mapper(:conference)
245
245
  # role_mapper = TerminologyTest.retrieve_mapper(:conference, :role)
246
246
  # text_mapper = TerminologyTest.retrieve_mapper(:conference, :role, :text)
@@ -270,12 +270,12 @@ describe "OM::XML::Terminology" do
270
270
  end
271
271
 
272
272
  it "should support queries with complex constraints" do
273
- pending
273
+ skip
274
274
  @test_full_terminology.xpath_for(:person, {:date=>"2010"}).should == '//oxns:name[@type="personal" and contains(oxns:namePart[@type="date"], "2010")]'
275
275
  end
276
276
 
277
277
  it "should support queries with multiple complex constraints" do
278
- pending
278
+ skip
279
279
  @test_full_terminology.xpath_for(:person, {:role=>"donor", :last_name=>"Rockefeller"}).should == '//oxns:name[@type="personal" and contains(oxns:role/oxns:roleTerm, "donor") and contains(oxns:namePart[@type="family"], "Rockefeller")]'
280
280
  end
281
281
 
@@ -25,14 +25,14 @@ describe "OM::XML::Validation" do
25
25
 
26
26
  describe "#schema" do
27
27
  it "should return an instance of Nokogiri::XML::Schema loaded from the schema url -- fails if no internet connection" do
28
- pending "no internet connection"
28
+ skip "no internet connection"
29
29
  ValidationTest.schema.should be_kind_of Nokogiri::XML::Schema
30
30
  end
31
31
  end
32
32
 
33
33
  describe "#validate" do
34
34
  it "should validate the provided document against the schema provided in class definition -- fails if no internet connection" do
35
- pending "no internet connection"
35
+ skip "no internet connection"
36
36
  ValidationTest.schema.should_receive(:validate).with(@sample).and_return([])
37
37
  ValidationTest.validate(@sample)
38
38
  end
@@ -73,7 +73,7 @@ describe "OM::XML::Validation" do
73
73
  lambda {ValidationTest.send(:file_from_url, "foo")}.should raise_error(RuntimeError, "Could not retrieve file from foo. Error: No such file or directory - foo")
74
74
  end
75
75
  it "should raise an error if file retrieval fails" do
76
- pending "no internet connection"
76
+ skip "no internet connection"
77
77
  lambda {ValidationTest.send(:file_from_url, "http://fedora-commons.org/nonexistent_file")}.should raise_error(RuntimeError, "Could not retrieve file from http://fedora-commons.org/nonexistent_file. Error: 404 Not Found")
78
78
  end
79
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: om
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-05 00:00:00.000000000 Z
12
+ date: 2014-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -205,6 +205,7 @@ extra_rdoc_files:
205
205
  files:
206
206
  - ".document"
207
207
  - ".gitignore"
208
+ - ".rspec"
208
209
  - ".travis.yml"
209
210
  - COMMON_OM_PATTERNS.textile
210
211
  - CONTRIBUTING.md