xqsr3-xml 0.1.1 → 0.1.3
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.
- checksums.yaml +5 -5
- data/AUTHORS.md +21 -0
- data/CHANGES.md +40 -0
- data/CONTRIBUTING.md +36 -0
- data/EXAMPLES.md +8 -0
- data/FAQ.md +27 -0
- data/INSTALL.md +41 -0
- data/LICENSE +21 -18
- data/NEWS.md +12 -0
- data/README.md +89 -23
- data/Rakefile +21 -0
- data/SECURITY.md +23 -0
- data/TODO.md +23 -0
- data/examples/compare_xml.md +47 -0
- data/examples/compare_xml.rb +20 -0
- data/lib/xqsr3/xml/utilities/compare.rb +311 -311
- data/lib/xqsr3/xml/utilities/navigation.rb +31 -31
- data/lib/xqsr3/xml/version.rb +19 -20
- data/test/unit/tc_version.rb +15 -15
- data/test/unit/xml/utilities/tc_compare.rb +94 -94
- data/test/unit/xml/utilities/tc_navigation.rb +17 -17
- metadata +48 -33
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
|
-
# File:
|
|
3
|
+
# File: lib/xqsr3/xml/_utilities/navigation.rb
|
|
4
4
|
#
|
|
5
|
-
# Purpose:
|
|
6
|
-
# module
|
|
5
|
+
# Purpose: Definition of the ::Xqsr3::XML::Utilities::Navigation module
|
|
7
6
|
#
|
|
8
|
-
# Created:
|
|
9
|
-
# Updated:
|
|
7
|
+
# Created: 7th August 2018
|
|
8
|
+
# Updated: 19th August 2026
|
|
10
9
|
#
|
|
11
|
-
# Home:
|
|
10
|
+
# Home: http://github.com/synesissoftware/xqsr3
|
|
12
11
|
#
|
|
13
|
-
# Author:
|
|
12
|
+
# Author: Matthew Wilson
|
|
14
13
|
#
|
|
15
|
-
# Copyright (c)
|
|
14
|
+
# Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
|
|
15
|
+
# Copyright (c) 2018-2019, Matthew Wilson and Synesis Software
|
|
16
16
|
# All rights reserved.
|
|
17
17
|
#
|
|
18
18
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -61,42 +61,42 @@ module Utilities
|
|
|
61
61
|
|
|
62
62
|
module Navigation
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
module Internal_Compare_
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
extend ::Xqsr3::Quality::ParameterChecking
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
def self.get_descendants node
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
descendants = []
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
node.children.each do |child|
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
descendants << child
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
descendants += self.get_descendants child
|
|
77
|
+
end
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
descendants
|
|
80
|
+
end
|
|
81
|
+
end # module Internal_Compare_
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
def self.included receiver
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
def receiver.get_descendants node
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
Internal_Compare_.get_descendants node
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
def self.get_descendants node
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
Internal_Compare_.get_descendants node
|
|
94
|
+
end
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
def get_descendants
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
Internal_Compare_.get_descendants self
|
|
99
|
+
end
|
|
100
100
|
end # module Navigation
|
|
101
101
|
|
|
102
102
|
end # module Utilities
|
data/lib/xqsr3/xml/version.rb
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
# ######################################################################## #
|
|
3
|
-
# File:
|
|
3
|
+
# File: lib/xqsr3/xml/version.rb
|
|
4
4
|
#
|
|
5
|
-
# Purpose:
|
|
5
|
+
# Purpose: Version for xqsr3-xml library
|
|
6
6
|
#
|
|
7
|
-
# Created:
|
|
8
|
-
# Updated:
|
|
7
|
+
# Created: 1st March 2019
|
|
8
|
+
# Updated: 19th August 2026
|
|
9
9
|
#
|
|
10
|
-
# Home:
|
|
10
|
+
# Home: https://github.com/synesissoftware/xqsr3-xml
|
|
11
11
|
#
|
|
12
|
-
# Author:
|
|
12
|
+
# Author: Matthew Wilson
|
|
13
13
|
#
|
|
14
|
+
# Copyright (c) 2019-2026, Matthew Wilson and Synesis Information Systems
|
|
14
15
|
# Copyright (c) 2019, Matthew Wilson and Synesis Software
|
|
15
16
|
# All rights reserved.
|
|
16
17
|
#
|
|
@@ -50,22 +51,20 @@
|
|
|
50
51
|
module Xqsr3
|
|
51
52
|
module XML
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
# Current version of the xqsr3-xml library
|
|
55
|
+
VERSION = '0.1.3'
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
private
|
|
58
|
+
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
|
59
|
+
public
|
|
60
|
+
# Major version of the xqsr3-xml library
|
|
61
|
+
VERSION_MAJOR = VERSION_PARTS_[0] # :nodoc:
|
|
62
|
+
# Minor version of the xqsr3-xml library
|
|
63
|
+
VERSION_MINOR = VERSION_PARTS_[1] # :nodoc:
|
|
64
|
+
# Revision version of the xqsr3-xml library
|
|
65
|
+
VERSION_REVISION = VERSION_PARTS_[2] # :nodoc:
|
|
65
66
|
|
|
66
67
|
end # module XML
|
|
67
68
|
end # module Xqsr3
|
|
68
69
|
|
|
69
70
|
# ############################## end of file ############################# #
|
|
70
|
-
|
|
71
|
-
|
data/test/unit/tc_version.rb
CHANGED
|
@@ -8,29 +8,29 @@ require 'test/unit'
|
|
|
8
8
|
|
|
9
9
|
class Test_version < Test::Unit::TestCase
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
def test_has_VERSION
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
assert defined? Xqsr3::XML::VERSION
|
|
14
|
+
end
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
def test_has_VERSION_MAJOR
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
assert defined? Xqsr3::XML::VERSION_MAJOR
|
|
19
|
+
end
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
def test_has_VERSION_MINOR
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
assert defined? Xqsr3::XML::VERSION_MINOR
|
|
24
|
+
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
def test_has_VERSION_REVISION
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
assert defined? Xqsr3::XML::VERSION_REVISION
|
|
29
|
+
end
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
def test_VERSION_has_consistent_format
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
assert_equal Xqsr3::XML::VERSION, "#{Xqsr3::XML::VERSION_MAJOR}.#{Xqsr3::XML::VERSION_MINOR}.#{Xqsr3::XML::VERSION_REVISION}"
|
|
34
|
+
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -9,104 +9,104 @@ require 'test/unit'
|
|
|
9
9
|
|
|
10
10
|
class Test_Xqsr3_XML_Utilities_Compare < Test::Unit::TestCase
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
include ::Xqsr3::XML::Utilities::Compare
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
def test_compare_nil
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
assert xml_compare(nil, nil).same?
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
assert_false xml_compare('', nil).same?
|
|
19
|
+
assert_false xml_compare(nil, '').same?
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
assert xml_compare('', nil, equate_nil_and_empty: true).same?
|
|
22
|
+
assert xml_compare(nil, '', equate_nil_and_empty: true).same?
|
|
23
|
+
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
def test_compare_empty
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
assert xml_compare('', '').same?
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
assert_false xml_compare('<abc/>', '').same?
|
|
30
|
+
assert_false xml_compare('', '<abc/>').same?
|
|
31
|
+
end
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
def test_compare_one_level_1
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
assert xml_compare('<abc/>', '<abc/>').same?
|
|
36
|
+
assert xml_compare('<abc/>', '<abc></abc>').same?
|
|
37
|
+
assert_false xml_compare('<abc/>', '<def/>').same?
|
|
38
|
+
end
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
def test_compare_two_level_1
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
assert xml_compare('<parent><child1></child1></parent>', '<parent><child1></child1></parent>').same?
|
|
43
|
+
assert xml_compare('<parent><child1/></parent>', '<parent><child1></child1></parent>').same?
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
r = xml_compare('<parent><child1/></parent>', '<parent><child2/></parent>')
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
assert_false r.same?
|
|
48
|
+
end
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
def test_compare_attributes_1
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
lhs = <<END_OF_lhs
|
|
53
53
|
<node name="John Smith" age="21" />
|
|
54
54
|
END_OF_lhs
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
rhs_same = <<END_OF_lhs
|
|
57
57
|
<node age="21" name="John Smith" />
|
|
58
58
|
END_OF_lhs
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
rhs_diff = <<END_OF_lhs
|
|
61
61
|
<node name="John Smith" age="22" />
|
|
62
62
|
END_OF_lhs
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
r = xml_compare lhs, rhs_same, ignore_attribute_order: false
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
assert r.different?, r.details
|
|
67
|
+
assert_equal :different_attribute_order, r.reason
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
r = xml_compare lhs, rhs_same, ignore_attribute_order: true
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
assert r.same?
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
r = xml_compare lhs, rhs_same, element_order: false
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
assert r.same?
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
r = xml_compare lhs, rhs_diff
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
assert r.different?
|
|
80
|
+
assert_equal :different_attributes, r.reason
|
|
81
|
+
end
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
def test_compare_two_level_2
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
lhs = <<END_OF_lhs
|
|
86
86
|
<parent>
|
|
87
87
|
<child1/>
|
|
88
88
|
</parent>
|
|
89
89
|
END_OF_lhs
|
|
90
|
-
|
|
90
|
+
rhs = <<END_OF_rhs
|
|
91
91
|
<parent>
|
|
92
92
|
<child1>
|
|
93
93
|
</child1>
|
|
94
94
|
</parent>
|
|
95
95
|
END_OF_rhs
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
r = xml_compare lhs, rhs, normalize_whitespace: false
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
assert r.different?, "#{r.details}"
|
|
100
|
+
assert_equal :different_node_contents, r.reason
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
r = xml_compare(lhs, rhs, normalize_whitespace: true)
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
assert r.same?, "#{r.details}"
|
|
105
|
+
end
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
def test_compare_two_level_3
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
lhs = <<END_OF_lhs
|
|
110
110
|
<parent>
|
|
111
111
|
<child1/>
|
|
112
112
|
<child2>
|
|
@@ -114,7 +114,7 @@ END_OF_rhs
|
|
|
114
114
|
</child2>
|
|
115
115
|
</parent>
|
|
116
116
|
END_OF_lhs
|
|
117
|
-
|
|
117
|
+
rhs = <<END_OF_rhs
|
|
118
118
|
<parent>
|
|
119
119
|
<child2><grandchild2a/></child2>
|
|
120
120
|
<child1>
|
|
@@ -122,14 +122,14 @@ END_OF_lhs
|
|
|
122
122
|
</parent>
|
|
123
123
|
END_OF_rhs
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
r = xml_compare lhs, rhs, normalize_whitespace: true
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
assert r.same?, "#{r.details}"
|
|
128
|
+
end
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
def test_different_declarations_and_dont_ignore
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
lhs_str = <<END_OF_lhs_doc
|
|
133
133
|
<?xml version="1.0"?>
|
|
134
134
|
<outer>
|
|
135
135
|
<mid>
|
|
@@ -138,27 +138,27 @@ END_OF_rhs
|
|
|
138
138
|
</outer>
|
|
139
139
|
END_OF_lhs_doc
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
rhs_str = <<END_OF_rhs_doc
|
|
142
142
|
<?xml version="1.0"?>
|
|
143
143
|
<mid>
|
|
144
144
|
<inner>some text</inner>
|
|
145
145
|
</mid>
|
|
146
146
|
END_OF_rhs_doc
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
lhs_doc = Nokogiri::XML lhs_str
|
|
149
|
+
rhs_doc = Nokogiri::XML rhs_str
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
expected = rhs_doc
|
|
152
|
+
actual = lhs_doc.at_xpath('/outer/mid')
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
r = xml_compare expected, actual, normalise_whitespace: true, ignore_xml_declarations: false
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
assert !r.same?
|
|
157
|
+
end
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
def test_different_declarations_and_do_ignore
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
lhs_str = <<END_OF_lhs_doc
|
|
162
162
|
<?xml version="1.0"?>
|
|
163
163
|
<outer>
|
|
164
164
|
<mid>
|
|
@@ -167,27 +167,27 @@ END_OF_rhs_doc
|
|
|
167
167
|
</outer>
|
|
168
168
|
END_OF_lhs_doc
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
rhs_str = <<END_OF_rhs_doc
|
|
171
171
|
<?xml version="1.0"?>
|
|
172
172
|
<mid>
|
|
173
173
|
<inner>some text</inner>
|
|
174
174
|
</mid>
|
|
175
175
|
END_OF_rhs_doc
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
lhs_doc = Nokogiri::XML lhs_str
|
|
178
|
+
rhs_doc = Nokogiri::XML rhs_str
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
expected = rhs_doc
|
|
181
|
+
actual = lhs_doc.at_xpath('/outer/mid')
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
r = xml_compare expected, actual, normalise_whitespace: true, ignore_xml_declarations: true
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
assert r.same?, "#{r.details}"
|
|
186
|
+
end
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
def test_different_node_contents_by_child_node_order
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
lhs_str = <<END_OF_lhs_doc
|
|
191
191
|
<?xml version="1.0"?>
|
|
192
192
|
<outer>
|
|
193
193
|
<mid_1>
|
|
@@ -199,7 +199,7 @@ END_OF_rhs_doc
|
|
|
199
199
|
</outer>
|
|
200
200
|
END_OF_lhs_doc
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
rhs_str = <<END_OF_rhs_doc
|
|
203
203
|
<?xml version="1.0"?>
|
|
204
204
|
<outer>
|
|
205
205
|
<mid_2>
|
|
@@ -211,25 +211,25 @@ END_OF_lhs_doc
|
|
|
211
211
|
</outer>
|
|
212
212
|
END_OF_rhs_doc
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
lhs_doc = Nokogiri::XML lhs_str
|
|
215
|
+
rhs_doc = Nokogiri::XML rhs_str
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
expected = rhs_doc
|
|
218
|
+
actual = lhs_doc
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
r = xml_compare expected, actual, ignore_child_node_order: true, normalise_whitespace: true, ignore_xml_declarations: true
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
assert r.same?, "#{r.details}"
|
|
223
|
+
end
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
def test_different_node_contents_by_child_node_order_and_whitespace
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
lhs_str = <<END_OF_lhs_doc
|
|
228
228
|
<?xml version="1.0"?>
|
|
229
229
|
<outer><mid_1><inner>some text</inner></mid_1><mid_2><inner>some more text</inner></mid_2></outer>
|
|
230
230
|
END_OF_lhs_doc
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
rhs_str = <<END_OF_rhs_doc
|
|
233
233
|
<?xml version="1.0"?>
|
|
234
234
|
<outer>
|
|
235
235
|
<mid_2>
|
|
@@ -241,16 +241,16 @@ END_OF_lhs_doc
|
|
|
241
241
|
</outer>
|
|
242
242
|
END_OF_rhs_doc
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
lhs_doc = Nokogiri::XML lhs_str
|
|
245
|
+
rhs_doc = Nokogiri::XML rhs_str
|
|
246
246
|
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
expected = rhs_doc
|
|
248
|
+
actual = lhs_doc
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
r = xml_compare expected, actual, ignore_child_node_order: true, normalise_whitespace: true, ignore_xml_declarations: true
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
assert r.same?, "#{r.details}"
|
|
253
|
+
end
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
|
|
@@ -11,11 +11,11 @@ require 'nokogiri'
|
|
|
11
11
|
|
|
12
12
|
class Test_Xqsr3_XML_Utilities_Navigation < Test::Unit::TestCase
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
include ::Xqsr3::XML::Utilities::Navigation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
def test_get_descendants_1
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
xml_s = <<END_OF_rhs_doc
|
|
19
19
|
<?xml version="1.0"?>
|
|
20
20
|
<document>
|
|
21
21
|
<outer>
|
|
@@ -29,27 +29,27 @@ class Test_Xqsr3_XML_Utilities_Navigation < Test::Unit::TestCase
|
|
|
29
29
|
</document>
|
|
30
30
|
END_OF_rhs_doc
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
xml = ::Nokogiri.XML(xml_s)
|
|
33
|
+
doc = xml.children.first
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
descs = self.class.get_descendants xml.children.first
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
assert_not_nil descs
|
|
38
|
+
assert_kind_of ::Array, descs
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
assert_operator 7, :<=, descs.size
|
|
41
|
+
%w{ outer mid_1 mid_2 }.each do |name|
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
assert(descs.find { |el| name == el.name }, "did not find an element named '#{name}' in the collection #{descs}")
|
|
44
|
+
end
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
texts = descs.select { |el| el.text? }
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
[ 'some text', 'some more text' ].each do |text|
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
assert(texts.find { |el| text == el.text }, "did not find an element with the text '#{text}' in the collection #{texts}")
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
|