om 1.8.1 → 1.9.0.pre1
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/Rakefile +1 -1
- data/container_spec.rb +14 -14
- data/lib/om.rb +12 -9
- data/lib/om/samples/mods_article.rb +9 -9
- data/lib/om/tree_node.rb +6 -6
- data/lib/om/version.rb +1 -1
- data/lib/om/xml.rb +33 -31
- data/lib/om/xml/container.rb +12 -12
- data/lib/om/xml/document.rb +19 -18
- data/lib/om/xml/dynamic_node.rb +50 -45
- data/lib/om/xml/named_term_proxy.rb +13 -13
- data/lib/om/xml/node_generator.rb +3 -3
- data/lib/om/xml/template_registry.rb +26 -18
- data/lib/om/xml/term.rb +46 -30
- data/lib/om/xml/term_value_operators.rb +56 -52
- data/lib/om/xml/term_xpath_generator.rb +57 -51
- data/lib/om/xml/terminology.rb +10 -8
- data/lib/om/xml/terminology_based_solrizer.rb +90 -0
- data/lib/om/xml/validation.rb +19 -19
- data/lib/om/xml/vocabulary.rb +4 -4
- data/lib/tasks/om.rake +6 -4
- data/om.gemspec +2 -1
- data/spec/fixtures/mods_article.rb +90 -0
- data/spec/fixtures/mods_articles/hydrangea_article1.xml +2 -2
- data/spec/integration/differentiated_elements_spec.rb +2 -2
- data/spec/integration/element_value_spec.rb +13 -13
- data/spec/integration/proxies_and_ref_spec.rb +15 -15
- data/spec/integration/querying_documents_spec.rb +18 -24
- data/spec/integration/rights_metadata_integration_example_spec.rb +18 -18
- data/spec/integration/selective_querying_spec.rb +1 -1
- data/spec/integration/serialization_spec.rb +13 -13
- data/spec/integration/set_reentrant_terminology_spec.rb +10 -10
- data/spec/integration/xpathy_stuff_spec.rb +16 -16
- data/spec/spec_helper.rb +2 -2
- data/spec/unit/container_spec.rb +29 -28
- data/spec/unit/document_spec.rb +50 -49
- data/spec/unit/dynamic_node_spec.rb +45 -57
- data/spec/unit/named_term_proxy_spec.rb +16 -16
- data/spec/unit/node_generator_spec.rb +7 -7
- data/spec/unit/nokogiri_sanity_spec.rb +30 -30
- data/spec/unit/om_spec.rb +5 -5
- data/spec/unit/template_registry_spec.rb +69 -69
- data/spec/unit/term_builder_spec.rb +77 -77
- data/spec/unit/term_spec.rb +73 -79
- data/spec/unit/term_value_operators_spec.rb +191 -186
- data/spec/unit/term_xpath_generator_spec.rb +43 -37
- data/spec/unit/terminology_builder_spec.rb +85 -85
- data/spec/unit/terminology_spec.rb +98 -98
- data/spec/unit/validation_spec.rb +22 -22
- data/spec/unit/xml_serialization_spec.rb +22 -21
- data/spec/unit/xml_spec.rb +7 -7
- data/spec/unit/xml_terminology_based_solrizer_spec.rb +109 -0
- metadata +57 -17
- checksums.yaml +0 -7
- data/.rspec +0 -1
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -382
- data/.travis.yml +0 -10
- data/gemfiles/gemfile.rails3 +0 -11
- data/gemfiles/gemfile.rails4 +0 -10
@@ -7,7 +7,7 @@ describe "an example with :proxy and :ref" do
|
|
7
7
|
|
8
8
|
set_terminology do |t|
|
9
9
|
t.root(:path => "outer", :xmlns => '', :namespace_prefix => nil)
|
10
|
-
|
10
|
+
|
11
11
|
t.resource(:namespace_prefix => nil) {
|
12
12
|
t.fedora_pid(:path=>{:attribute=>"objectId"}, :namespace_prefix => nil)
|
13
13
|
t.file(:ref=>[:file], :namespace_prefix => nil, :namespace_prefix => nil)
|
@@ -18,16 +18,16 @@ describe "an example with :proxy and :ref" do
|
|
18
18
|
t.md5(:path=>"checksum", :attributes=>{:type=>"md5"}, :namespace_prefix => nil)
|
19
19
|
t.sha1(:path=>"checksum", :attributes=>{:type=>"sha1"}, :namespace_prefix => nil)
|
20
20
|
}
|
21
|
-
# really want ead where the type is ead and the file format is XML and the file mimetype is text/xml (and the file id is (?coll_ead.xml ... can be whatever the label of the DS is in the FileAsset object))
|
22
|
-
t.ead(:ref=>:resource, :attributes=>{:type=>"ead"})
|
21
|
+
# really want ead where the type is ead and the file format is XML and the file mimetype is text/xml (and the file id is (?coll_ead.xml ... can be whatever the label of the DS is in the FileAsset object))
|
22
|
+
t.ead(:ref=>:resource, :attributes=>{:type=>"ead"})
|
23
23
|
t.image(:ref=>:resource, :attributes=>{:type=>"image"})
|
24
|
-
|
24
|
+
|
25
25
|
t.ead_fedora_pid(:proxy=>[:ead, :fedora_pid])
|
26
26
|
t.ead_ds_label(:proxy=>[:ead, :file, :ds_label])
|
27
27
|
t.ead_size(:proxy=>[:ead, :file, :size])
|
28
28
|
t.ead_md5(:proxy=>[:ead, :file, :md5])
|
29
29
|
t.ead_sha1(:proxy=>[:ead, :file, :sha1])
|
30
|
-
|
30
|
+
|
31
31
|
t.image_fedora_pid(:proxy=>[:image, :fedora_pid])
|
32
32
|
t.image_ds_label(:proxy=>[:image, :file, :ds_label])
|
33
33
|
t.image_size(:proxy=>[:image, :file, :size])
|
@@ -59,21 +59,21 @@ end
|
|
59
59
|
|
60
60
|
describe "image" do
|
61
61
|
it "should have the right proxy terms" do
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
67
|
end
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "ead" do
|
71
71
|
it "should have the right proxy terms" do
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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"
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -12,36 +12,31 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "xpath_for()" do
|
15
|
-
|
15
|
+
@term.xpath_for(:name).should ==
|
16
16
|
'//oxns:name'
|
17
|
-
)
|
18
|
-
expect(@term.xpath_for(:person)).to eq(
|
17
|
+
@term.xpath_for(:person).should ==
|
19
18
|
'//oxns:name[@type="personal"]'
|
20
|
-
)
|
21
|
-
expect(@term.xpath_for(:organization)).to eq(
|
19
|
+
@term.xpath_for(:organization).should ==
|
22
20
|
'//oxns:name[@type="corporate"]'
|
23
|
-
)
|
24
|
-
expect(@term.xpath_for(:person, :first_name)).to eq(
|
21
|
+
@term.xpath_for(:person, :first_name).should ==
|
25
22
|
'//oxns:name[@type="personal"]/oxns:namePart[@type="given"]'
|
26
|
-
)
|
27
|
-
expect(@term.xpath_for(:journal, :issue, :pages, :start)).to eq(
|
23
|
+
@term.xpath_for(:journal, :issue, :pages, :start).should ==
|
28
24
|
'//oxns:relatedItem[@type="host"]/oxns:part/oxns:extent[@unit="pages"]/oxns:start'
|
29
|
-
)
|
30
25
|
end
|
31
26
|
|
32
27
|
it "term_values()" do
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
@doc.term_values(:person, :first_name).should == ["GIVEN NAMES", "Siddartha"]
|
29
|
+
@doc.term_values(:person, :last_name).should == ["FAMILY NAME", "Gautama"]
|
30
|
+
@doc.term_values(:organization, :namePart).should == ['NSF']
|
31
|
+
@doc.term_values(:journal, :issue, :pages, :start).should == ['195']
|
32
|
+
@doc.term_values(:journal, :title_info, :main_title).should == ["TITLE OF HOST JOURNAL"]
|
38
33
|
end
|
39
34
|
|
40
35
|
it "xpath_for(): relative vs absolute" do
|
41
36
|
xp_rel = '//oxns:titleInfo/oxns:title'
|
42
37
|
xp_abs = '//oxns:mods/oxns:titleInfo/oxns:title'
|
43
|
-
|
44
|
-
|
38
|
+
@term.xpath_for( :title_info, :main_title).should == xp_rel
|
39
|
+
@term.xpath_for(:mods, :title_info, :main_title).should == xp_abs
|
45
40
|
end
|
46
41
|
|
47
42
|
it "term_values(): relative vs absolute" do
|
@@ -51,16 +46,16 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
51
46
|
"TITLE OF HOST JOURNAL",
|
52
47
|
]
|
53
48
|
xp_abs = '//oxns:mods/oxns:titleInfo/oxns:title'
|
54
|
-
|
55
|
-
|
49
|
+
@doc.term_values( :title_info, :main_title).should == exp
|
50
|
+
@doc.term_values(:mods, :title_info, :main_title).should == exp[0..1]
|
56
51
|
end
|
57
52
|
|
58
53
|
it "find_by_terms()" do
|
59
54
|
exp_xml_role = '<role><roleTerm authority="marcrelator" type="text">funder</roleTerm></role>'
|
60
55
|
exp_xml_start = '<start>195</start>'
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
@doc.find_by_terms(:organization, :role).class.should == Nokogiri::XML::NodeSet
|
57
|
+
@doc.find_by_terms(:organization, :role).to_xml.should be_equivalent_to exp_xml_role
|
58
|
+
@doc.find_by_terms(:journal, :issue, :pages, :start).to_xml.should == exp_xml_start
|
64
59
|
end
|
65
60
|
|
66
61
|
it "find_by_terms() error" do
|
@@ -69,9 +64,8 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
69
64
|
end
|
70
65
|
|
71
66
|
it "proxies" do
|
72
|
-
|
67
|
+
@term.xpath_for(:title).should ==
|
73
68
|
'//oxns:titleInfo/oxns:title'
|
74
|
-
)
|
75
69
|
@term.xpath_for(:journal_title)
|
76
70
|
'//oxns:relatedItem[@type="host"]/oxns:titleInfo/oxns:title'
|
77
71
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "OM::XML::Accessors" do
|
4
|
-
|
4
|
+
|
5
5
|
before(:all) do
|
6
6
|
class RightsMDTest
|
7
|
-
|
7
|
+
|
8
8
|
include OM::XML::Document
|
9
|
-
|
9
|
+
|
10
10
|
terminology = OM::XML::Terminology::Builder.new do |t|
|
11
11
|
t.rightsMetadata(:xmlns=>"http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd") {
|
12
12
|
t.access {
|
@@ -19,19 +19,19 @@ describe "OM::XML::Accessors" do
|
|
19
19
|
t.edit_access(:variant_of=>:access, :attributes=>{:type=>"personal"})
|
20
20
|
}
|
21
21
|
end
|
22
|
-
# root_property :rightsMetadata, "rightsMetadata", "http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd"
|
23
|
-
#
|
22
|
+
# root_property :rightsMetadata, "rightsMetadata", "http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1", :schema=>"http://github.com/projecthydra/schemas/tree/v1/rightsMetadata.xsd"
|
23
|
+
#
|
24
24
|
# property :access, :path=>"access",
|
25
25
|
# :subelements=>[:machine],
|
26
26
|
# :convenience_methods => {
|
27
27
|
# :human_readable => {:path=>"human"}
|
28
28
|
# }
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# property :edit_access, :variant_of=>:access, :attributes=>{:type=>"edit"}
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# property :machine, :path=>"machine",
|
33
33
|
# :subelements=>["group","person"]
|
34
|
-
|
34
|
+
|
35
35
|
# generate_accessors_from_properties
|
36
36
|
# Generates an empty Mods Article (used when you call ModsArticle.new without passing in existing xml)
|
37
37
|
def self.xml_template
|
@@ -53,24 +53,24 @@ describe "OM::XML::Accessors" do
|
|
53
53
|
xml.machine
|
54
54
|
}
|
55
55
|
}
|
56
|
-
end
|
57
|
-
builder.doc
|
56
|
+
end
|
57
|
+
return builder.doc
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
before(:each) do
|
63
63
|
@sample = RightsMDTest.from_xml(nil)
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
describe "update_properties" do
|
67
67
|
it "should update the declared properties" do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
pending "nesting is too deep..."
|
69
|
+
@sample.retrieve(*[:edit_access, :machine, :person]).length.should == 0
|
70
|
+
@sample.update_properties([:edit_access, :machine, :person]=>"user id").should == {"edit_access_machine_person"=>{"-1"=>"user id"}}
|
71
|
+
@sample.retrieve(*[:edit_access, :machine, :person]).length.should == 1
|
72
|
+
@sample.retrieve(*[:edit_access, :machine, :person]).first.text.should == "user id"
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
end
|
@@ -83,7 +83,7 @@ describe "Selecting nodes based on (a) position in hierarchy and (b) attributes"
|
|
83
83
|
[ 'inner_note_a', %w( i3a i4a) ],
|
84
84
|
[ 'inner_note_not_a', %w( i1 i2 ) ],
|
85
85
|
]
|
86
|
-
tests.each { |meth, exp|
|
86
|
+
tests.each { |meth, exp| @doc.send(meth).should == exp }
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -30,19 +30,19 @@ EOF
|
|
30
30
|
end
|
31
31
|
describe "reading values" do
|
32
32
|
it "should deserialize date" do
|
33
|
-
|
33
|
+
subject.my_date.should == [Date.parse('2012-10-30')]
|
34
34
|
end
|
35
35
|
it "should deserialize ints" do
|
36
|
-
|
36
|
+
subject.my_int.should == [7]
|
37
37
|
end
|
38
38
|
it "should deserialize boolean" do
|
39
|
-
|
39
|
+
subject.active.should == [true]
|
40
40
|
end
|
41
41
|
end
|
42
42
|
describe "Writing to xml" do
|
43
43
|
it "should serialize date" do
|
44
44
|
subject.my_date = [Date.parse('2012-09-22')]
|
45
|
-
|
45
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
46
46
|
<outer outerId="hypatia:outer" type="outer type">
|
47
47
|
<my_date>2012-09-22</my_date>
|
48
48
|
<my_int>7</my_int>
|
@@ -51,7 +51,7 @@ EOF
|
|
51
51
|
end
|
52
52
|
it "should serialize ints" do
|
53
53
|
subject.my_int = [9]
|
54
|
-
|
54
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
55
55
|
<outer outerId="hypatia:outer" type="outer type">
|
56
56
|
<my_date>2012-10-30</my_date>
|
57
57
|
<my_int>9</my_int>
|
@@ -60,7 +60,7 @@ EOF
|
|
60
60
|
end
|
61
61
|
it "should serialize boolean" do
|
62
62
|
subject.active = [false]
|
63
|
-
|
63
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
64
64
|
<outer outerId="hypatia:outer" type="outer type">
|
65
65
|
<my_date>2012-10-30</my_date>
|
66
66
|
<my_int>7</my_int>
|
@@ -82,19 +82,19 @@ EOF
|
|
82
82
|
end
|
83
83
|
describe "reading values" do
|
84
84
|
it "should deserialize date" do
|
85
|
-
|
85
|
+
subject.my_date.should == [nil]
|
86
86
|
end
|
87
87
|
it "should deserialize ints" do
|
88
|
-
|
88
|
+
subject.my_int.should == [nil]
|
89
89
|
end
|
90
90
|
it "should deserialize bools" do
|
91
|
-
|
91
|
+
subject.active.should == [false]
|
92
92
|
end
|
93
93
|
end
|
94
94
|
describe "Writing to xml" do
|
95
95
|
it "should serialize date" do
|
96
96
|
subject.my_date = [Date.parse('2012-09-22')]
|
97
|
-
|
97
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
98
98
|
<outer outerId="hypatia:outer" type="outer type">
|
99
99
|
<my_date>2012-09-22</my_date>
|
100
100
|
<my_int></my_int>
|
@@ -103,7 +103,7 @@ EOF
|
|
103
103
|
end
|
104
104
|
it "should serialize ints" do
|
105
105
|
subject.my_int = [9]
|
106
|
-
|
106
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
107
107
|
<outer outerId="hypatia:outer" type="outer type">
|
108
108
|
<my_date></my_date>
|
109
109
|
<my_int>9</my_int>
|
@@ -112,7 +112,7 @@ EOF
|
|
112
112
|
end
|
113
113
|
it "should serialize booleans" do
|
114
114
|
subject.active = [true]
|
115
|
-
|
115
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
116
116
|
<outer outerId="hypatia:outer" type="outer type">
|
117
117
|
<my_date></my_date>
|
118
118
|
<my_int></my_int>
|
@@ -124,7 +124,7 @@ EOF
|
|
124
124
|
subject.my_int = [nil]
|
125
125
|
subject.my_date = [nil]
|
126
126
|
subject.active = [nil]
|
127
|
-
|
127
|
+
subject.to_xml.should be_equivalent_to '<?xml version="1.0"?>
|
128
128
|
<outer outerId="hypatia:outer" type="outer type">
|
129
129
|
</outer>'
|
130
130
|
end
|
@@ -21,11 +21,11 @@ describe "calling set_terminology more than once" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "can get foo" do
|
24
|
-
|
24
|
+
subject.foo.should == ['fooval']
|
25
25
|
end
|
26
26
|
|
27
27
|
it "cannot get bar" do
|
28
|
-
expect { subject.bar }.to raise_error
|
28
|
+
expect { subject.bar }.to raise_error NoMethodError
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
@@ -47,11 +47,11 @@ describe "calling set_terminology more than once" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "cannot get foo" do
|
50
|
-
expect { subject.foo }.to raise_error
|
50
|
+
expect { subject.foo }.to raise_error NoMethodError
|
51
51
|
end
|
52
52
|
|
53
53
|
it "can now get bar" do
|
54
|
-
|
54
|
+
subject.bar.should == ['barval']
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -80,11 +80,11 @@ describe "calling set_terminology more than once" do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "can get foo" do
|
83
|
-
|
83
|
+
subject.foo.should == ['fooval']
|
84
84
|
end
|
85
85
|
|
86
86
|
it "can get bar" do
|
87
|
-
|
87
|
+
subject.bar.should == ['barval']
|
88
88
|
end
|
89
89
|
|
90
90
|
end
|
@@ -100,7 +100,7 @@ describe "calling set_terminology more than once" do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
class LocalReentrantTerminology
|
103
|
+
class LocalReentrantTerminology
|
104
104
|
include OM::XML::Document
|
105
105
|
use_terminology(ReentrantTerminology)
|
106
106
|
extend_terminology do |t|
|
@@ -118,15 +118,15 @@ describe "calling set_terminology more than once" do
|
|
118
118
|
xml = '<root xmlns="asdf"><foo>fooval</foo><bar>barval</bar></root>'
|
119
119
|
t = ReentrantTerminology.from_xml(xml)
|
120
120
|
|
121
|
-
expect { t.bar }.to raise_error
|
121
|
+
expect { t.bar }.to raise_error NoMethodError
|
122
122
|
end
|
123
123
|
|
124
124
|
it "can get foo" do
|
125
|
-
|
125
|
+
subject.foo.should == ['fooval']
|
126
126
|
end
|
127
127
|
|
128
128
|
it "can get bar" do
|
129
|
-
|
129
|
+
subject.bar.should == ['barval']
|
130
130
|
end
|
131
131
|
|
132
132
|
end
|
@@ -8,7 +8,7 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
8
8
|
include OM::XML::Document
|
9
9
|
|
10
10
|
set_terminology do |t|
|
11
|
-
t.root(:path=>"contentMetadata", :xmlns => '', :namespace_prefix => nil)
|
11
|
+
t.root(:path=>"contentMetadata", :xmlns => '', :namespace_prefix => nil)
|
12
12
|
|
13
13
|
t.resource(:namespace_prefix => nil) {
|
14
14
|
t.file(:ref=>[:file], :namespace_prefix => nil)
|
@@ -51,11 +51,11 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should have a content term" do
|
54
|
-
|
54
|
+
subject.content.first.should =~ /content/
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should have an html term" do
|
58
|
-
|
58
|
+
subject.html.first.should =~ /html/
|
59
59
|
end
|
60
60
|
|
61
61
|
|
@@ -63,7 +63,7 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
63
63
|
|
64
64
|
describe "an example from MODS" do
|
65
65
|
before(:all) do
|
66
|
-
class ModsXpathyStuffTerminology
|
66
|
+
class ModsXpathyStuffTerminology
|
67
67
|
include OM::XML::Document
|
68
68
|
|
69
69
|
set_terminology do |t|
|
@@ -120,15 +120,15 @@ 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
|
-
|
124
|
-
|
125
|
-
|
123
|
+
pending "This doesn't seem to work?"
|
124
|
+
subject.author_given.should include("Mary")
|
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
|
-
|
130
|
-
|
131
|
-
|
129
|
+
pending "This doesn't seem to work?"
|
130
|
+
subject.advisor_given.should include("David")
|
131
|
+
subject.advisor_family.should include("Small")
|
132
132
|
end
|
133
133
|
|
134
134
|
end
|
@@ -136,7 +136,7 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
136
136
|
describe "more MODS examples, with a given namespace prefix?" do
|
137
137
|
|
138
138
|
before(:all) do
|
139
|
-
class ModsXpathyStuffTerminology
|
139
|
+
class ModsXpathyStuffTerminology
|
140
140
|
include OM::XML::Document
|
141
141
|
|
142
142
|
set_terminology do |t|
|
@@ -153,7 +153,7 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
153
153
|
t.role_term_text(:path=>"roleTerm", :attributes=>{:type=>"text"})
|
154
154
|
}
|
155
155
|
|
156
|
-
t.person_full(:ref=>:name, :attributes=>{:type=>"personal"})
|
156
|
+
t.person_full(:ref=>:name, :attributes=>{:type=>"personal"})
|
157
157
|
t.person(:proxy=>[:person_full, :name_part])
|
158
158
|
t.creator(:ref=>:person, :path=>'name[mods:role/mods:roleTerm="creator"]', :xmlns=>"http://www.loc.gov/mods/v3", :namespace_prefix => "mods")
|
159
159
|
|
@@ -185,19 +185,19 @@ describe "an example of xpath-y stuff, also using :proxy and :ref and namespaces
|
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should give a creator value" do
|
188
|
-
|
188
|
+
subject.creator.should include "David Small"
|
189
189
|
end
|
190
190
|
|
191
191
|
it "should give a repository value" do
|
192
|
-
|
192
|
+
subject.repository.should include "Graphic Novel Repository"
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should have a person term 'for more generic xml'" do
|
196
|
-
|
196
|
+
subject.person.should include "David Small"
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should have a corporate term 'for more generic xml'" do
|
200
|
-
|
200
|
+
subject.corporate.should include "Graphic Novel Repository"
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|