om 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +382 -0
- data/.travis.yml +10 -0
- data/Rakefile +1 -1
- data/container_spec.rb +14 -14
- data/gemfiles/gemfile.rails3 +11 -0
- data/gemfiles/gemfile.rails4 +10 -0
- data/lib/om.rb +9 -12
- 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 +18 -20
- data/lib/om/xml/container.rb +12 -12
- data/lib/om/xml/document.rb +3 -7
- data/lib/om/xml/dynamic_node.rb +45 -50
- 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 +18 -26
- data/lib/om/xml/term.rb +30 -46
- data/lib/om/xml/term_value_operators.rb +52 -56
- data/lib/om/xml/term_xpath_generator.rb +51 -57
- data/lib/om/xml/terminology.rb +8 -10
- data/lib/om/xml/validation.rb +19 -19
- data/lib/om/xml/vocabulary.rb +4 -4
- data/lib/tasks/om.rake +4 -6
- data/om.gemspec +1 -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 +24 -18
- 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 +7 -7
- data/spec/integration/xpathy_stuff_spec.rb +16 -16
- data/spec/spec_helper.rb +2 -3
- data/spec/unit/container_spec.rb +28 -29
- data/spec/unit/document_spec.rb +49 -50
- data/spec/unit/dynamic_node_spec.rb +55 -47
- 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 +78 -72
- data/spec/unit/term_value_operators_spec.rb +186 -191
- data/spec/unit/term_xpath_generator_spec.rb +37 -43
- 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 +21 -22
- data/spec/unit/xml_spec.rb +7 -7
- metadata +143 -147
data/om.gemspec
CHANGED
@@ -17,11 +17,10 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_dependency('nokogiri', ">= 1.4.2")
|
18
18
|
s.add_dependency('mediashelf-loggable')
|
19
19
|
s.add_dependency('deprecation')
|
20
|
-
s.add_development_dependency "rspec", "~> 2.
|
20
|
+
s.add_development_dependency "rspec", "~> 2.99"
|
21
21
|
s.add_development_dependency "rake"
|
22
22
|
s.add_development_dependency "rdoc"
|
23
23
|
s.add_development_dependency "awesome_print"
|
24
|
-
s.add_development_dependency "mocha", ">= 0.9.8"
|
25
24
|
s.add_development_dependency "equivalent-xml", ">= 0.2.4"
|
26
25
|
|
27
26
|
s.files = `git ls-files`.split("\n")
|
@@ -30,10 +30,10 @@ describe "use the root element as a member of the proxy address" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should pull out all occurences of the_thing_we_want in the relevant_container" do
|
33
|
-
subject.relevant_container.the_thing_we_want.
|
33
|
+
expect(subject.relevant_container.the_thing_we_want).to eq(["1", "2"])
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should only pull out the_thing_we_want at the root level" do
|
37
|
-
subject.the_thing_we_want.
|
37
|
+
expect(subject.the_thing_we_want).to eq(["2"])
|
38
38
|
end
|
39
39
|
end
|
@@ -53,39 +53,39 @@ EOF
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should handle single-element terms correctly" do
|
56
|
-
subject.elementA.
|
56
|
+
expect(subject.elementA).to eq(["valA"])
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should handle term paths" do
|
60
|
-
subject.elC.
|
60
|
+
expect(subject.elC).to eq(["valC"])
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should handle multiple-element, terms with paths correctly" do
|
64
|
-
subject.elB.
|
64
|
+
expect(subject.elB).to eq(["valB1", "valB2"])
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should handle terms that require specific attributes" do
|
68
|
-
subject.elementC.
|
68
|
+
expect(subject.elementC).to eq(["valC"])
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should handle" do
|
72
|
-
subject.here.length.
|
73
|
-
subject.here.first.split(/\W/).
|
72
|
+
expect(subject.here.length).to eq(1)
|
73
|
+
expect(subject.here.first.split(/\W/)).to include('123', '456')
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should handle missing terms" do
|
77
|
-
subject.there.
|
77
|
+
expect(subject.there).to be_empty
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should handle element value given the absence of a specific attribute" do
|
81
|
-
subject.elementD.
|
82
|
-
subject.no_attrib.
|
81
|
+
expect(subject.elementD).to eq(["valD1"])
|
82
|
+
expect(subject.no_attrib).to eq(["valB1"])
|
83
83
|
end
|
84
84
|
|
85
85
|
it "should handle OM terms for an attribute value" do
|
86
|
-
subject.elementB.my_attr.
|
87
|
-
subject.alternate.
|
88
|
-
subject.another.
|
89
|
-
subject.animal_attrib.
|
86
|
+
expect(subject.elementB.my_attr).to eq(["vole"])
|
87
|
+
expect(subject.alternate).to eq(["vole"])
|
88
|
+
expect(subject.another).to eq(["vole"])
|
89
|
+
expect(subject.animal_attrib).to include("vole", "seagull")
|
90
90
|
end
|
91
91
|
end
|
@@ -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
|
-
subject.ead_fedora_pid.
|
63
|
-
subject.ead_ds_label.
|
64
|
-
subject.ead_size.
|
65
|
-
subject.ead_md5.
|
66
|
-
subject.ead_sha1.
|
62
|
+
expect(subject.ead_fedora_pid).to include "hypatia:ead_file_asset_fixture"
|
63
|
+
expect(subject.ead_ds_label).to include "my_ead.xml"
|
64
|
+
expect(subject.ead_size).to include "47570"
|
65
|
+
expect(subject.ead_md5).to include "123"
|
66
|
+
expect(subject.ead_sha1).to 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
|
-
subject.image_fedora_pid.
|
73
|
-
subject.image_ds_label.
|
74
|
-
subject.image_size.
|
75
|
-
subject.image_md5.
|
76
|
-
subject.image_sha1.
|
72
|
+
expect(subject.image_fedora_pid).to include "hypatia:coll_img_file_asset_fixture"
|
73
|
+
expect(subject.image_ds_label).to include "my_image.jpg"
|
74
|
+
expect(subject.image_size).to include "302080"
|
75
|
+
expect(subject.image_md5).to include "789"
|
76
|
+
expect(subject.image_sha1).to include "666"
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -12,31 +12,36 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "xpath_for()" do
|
15
|
-
@term.xpath_for(:name).
|
15
|
+
expect(@term.xpath_for(:name)).to eq(
|
16
16
|
'//oxns:name'
|
17
|
-
|
17
|
+
)
|
18
|
+
expect(@term.xpath_for(:person)).to eq(
|
18
19
|
'//oxns:name[@type="personal"]'
|
19
|
-
|
20
|
+
)
|
21
|
+
expect(@term.xpath_for(:organization)).to eq(
|
20
22
|
'//oxns:name[@type="corporate"]'
|
21
|
-
|
23
|
+
)
|
24
|
+
expect(@term.xpath_for(:person, :first_name)).to eq(
|
22
25
|
'//oxns:name[@type="personal"]/oxns:namePart[@type="given"]'
|
23
|
-
|
26
|
+
)
|
27
|
+
expect(@term.xpath_for(:journal, :issue, :pages, :start)).to eq(
|
24
28
|
'//oxns:relatedItem[@type="host"]/oxns:part/oxns:extent[@unit="pages"]/oxns:start'
|
29
|
+
)
|
25
30
|
end
|
26
31
|
|
27
32
|
it "term_values()" do
|
28
|
-
@doc.term_values(:person, :first_name).
|
29
|
-
@doc.term_values(:person, :last_name).
|
30
|
-
@doc.term_values(:organization, :namePart).
|
31
|
-
@doc.term_values(:journal, :issue, :pages, :start).
|
32
|
-
@doc.term_values(:journal, :title_info, :main_title).
|
33
|
+
expect(@doc.term_values(:person, :first_name)).to eq(["GIVEN NAMES", "Siddartha"])
|
34
|
+
expect(@doc.term_values(:person, :last_name)).to eq(["FAMILY NAME", "Gautama"])
|
35
|
+
expect(@doc.term_values(:organization, :namePart)).to eq(['NSF'])
|
36
|
+
expect(@doc.term_values(:journal, :issue, :pages, :start)).to eq(['195'])
|
37
|
+
expect(@doc.term_values(:journal, :title_info, :main_title)).to eq(["TITLE OF HOST JOURNAL"])
|
33
38
|
end
|
34
39
|
|
35
40
|
it "xpath_for(): relative vs absolute" do
|
36
41
|
xp_rel = '//oxns:titleInfo/oxns:title'
|
37
42
|
xp_abs = '//oxns:mods/oxns:titleInfo/oxns:title'
|
38
|
-
@term.xpath_for( :title_info, :main_title).
|
39
|
-
@term.xpath_for(:mods, :title_info, :main_title).
|
43
|
+
expect(@term.xpath_for( :title_info, :main_title)).to eq(xp_rel)
|
44
|
+
expect(@term.xpath_for(:mods, :title_info, :main_title)).to eq(xp_abs)
|
40
45
|
end
|
41
46
|
|
42
47
|
it "term_values(): relative vs absolute" do
|
@@ -46,16 +51,16 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
46
51
|
"TITLE OF HOST JOURNAL",
|
47
52
|
]
|
48
53
|
xp_abs = '//oxns:mods/oxns:titleInfo/oxns:title'
|
49
|
-
@doc.term_values( :title_info, :main_title).
|
50
|
-
@doc.term_values(:mods, :title_info, :main_title).
|
54
|
+
expect(@doc.term_values( :title_info, :main_title)).to eq(exp)
|
55
|
+
expect(@doc.term_values(:mods, :title_info, :main_title)).to eq(exp[0..1])
|
51
56
|
end
|
52
57
|
|
53
58
|
it "find_by_terms()" do
|
54
59
|
exp_xml_role = '<role><roleTerm authority="marcrelator" type="text">funder</roleTerm></role>'
|
55
60
|
exp_xml_start = '<start>195</start>'
|
56
|
-
@doc.find_by_terms(:organization, :role).class.
|
57
|
-
@doc.find_by_terms(:organization, :role).to_xml.
|
58
|
-
@doc.find_by_terms(:journal, :issue, :pages, :start).to_xml.
|
61
|
+
expect(@doc.find_by_terms(:organization, :role).class).to eq(Nokogiri::XML::NodeSet)
|
62
|
+
expect(@doc.find_by_terms(:organization, :role).to_xml).to be_equivalent_to exp_xml_role
|
63
|
+
expect(@doc.find_by_terms(:journal, :issue, :pages, :start).to_xml).to eq(exp_xml_start)
|
59
64
|
end
|
60
65
|
|
61
66
|
it "find_by_terms() error" do
|
@@ -64,8 +69,9 @@ describe "Rspec tests for QUERYING_DOCUMENTS.textile" do
|
|
64
69
|
end
|
65
70
|
|
66
71
|
it "proxies" do
|
67
|
-
@term.xpath_for(:title).
|
72
|
+
expect(@term.xpath_for(:title)).to eq(
|
68
73
|
'//oxns:titleInfo/oxns:title'
|
74
|
+
)
|
69
75
|
@term.xpath_for(:journal_title)
|
70
76
|
'//oxns:relatedItem[@type="host"]/oxns:titleInfo/oxns:title'
|
71
77
|
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
|
-
|
56
|
+
end
|
57
|
+
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
|
-
@sample.retrieve(*[:edit_access, :machine, :person]).length.
|
70
|
-
@sample.update_properties([:edit_access, :machine, :person]=>"user id").
|
71
|
-
@sample.retrieve(*[:edit_access, :machine, :person]).length.
|
72
|
-
@sample.retrieve(*[:edit_access, :machine, :person]).first.text.
|
68
|
+
skip "nesting is too deep..."
|
69
|
+
expect(@sample.retrieve(*[:edit_access, :machine, :person]).length).to eq(0)
|
70
|
+
expect(@sample.update_properties([:edit_access, :machine, :person]=>"user id")).to eq({"edit_access_machine_person"=>{"-1"=>"user id"}})
|
71
|
+
expect(@sample.retrieve(*[:edit_access, :machine, :person]).length).to eq(1)
|
72
|
+
expect(@sample.retrieve(*[:edit_access, :machine, :person]).first.text).to eq("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| @doc.send(meth).
|
86
|
+
tests.each { |meth, exp| expect(@doc.send(meth)).to eq(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
|
-
subject.my_date.
|
33
|
+
expect(subject.my_date).to eq([Date.parse('2012-10-30')])
|
34
34
|
end
|
35
35
|
it "should deserialize ints" do
|
36
|
-
subject.my_int.
|
36
|
+
expect(subject.my_int).to eq([7])
|
37
37
|
end
|
38
38
|
it "should deserialize boolean" do
|
39
|
-
subject.active.
|
39
|
+
expect(subject.active).to eq([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
|
-
subject.to_xml.
|
45
|
+
expect(subject.to_xml).to 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
|
-
subject.to_xml.
|
54
|
+
expect(subject.to_xml).to 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
|
-
subject.to_xml.
|
63
|
+
expect(subject.to_xml).to 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
|
-
subject.my_date.
|
85
|
+
expect(subject.my_date).to eq([nil])
|
86
86
|
end
|
87
87
|
it "should deserialize ints" do
|
88
|
-
subject.my_int.
|
88
|
+
expect(subject.my_int).to eq([nil])
|
89
89
|
end
|
90
90
|
it "should deserialize bools" do
|
91
|
-
subject.active.
|
91
|
+
expect(subject.active).to eq([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
|
-
subject.to_xml.
|
97
|
+
expect(subject.to_xml).to 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
|
-
subject.to_xml.
|
106
|
+
expect(subject.to_xml).to 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
|
-
subject.to_xml.
|
115
|
+
expect(subject.to_xml).to 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
|
-
subject.to_xml.
|
127
|
+
expect(subject.to_xml).to be_equivalent_to '<?xml version="1.0"?>
|
128
128
|
<outer outerId="hypatia:outer" type="outer type">
|
129
129
|
</outer>'
|
130
130
|
end
|
@@ -21,7 +21,7 @@ describe "calling set_terminology more than once" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "can get foo" do
|
24
|
-
subject.foo.
|
24
|
+
expect(subject.foo).to eq(['fooval'])
|
25
25
|
end
|
26
26
|
|
27
27
|
it "cannot get bar" do
|
@@ -51,7 +51,7 @@ describe "calling set_terminology more than once" do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "can now get bar" do
|
54
|
-
subject.bar.
|
54
|
+
expect(subject.bar).to eq(['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
|
-
subject.foo.
|
83
|
+
expect(subject.foo).to eq(['fooval'])
|
84
84
|
end
|
85
85
|
|
86
86
|
it "can get bar" do
|
87
|
-
subject.bar.
|
87
|
+
expect(subject.bar).to eq(['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|
|
@@ -122,11 +122,11 @@ describe "calling set_terminology more than once" do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "can get foo" do
|
125
|
-
subject.foo.
|
125
|
+
expect(subject.foo).to eq(['fooval'])
|
126
126
|
end
|
127
127
|
|
128
128
|
it "can get bar" do
|
129
|
-
subject.bar.
|
129
|
+
expect(subject.bar).to eq(['barval'])
|
130
130
|
end
|
131
131
|
|
132
132
|
end
|