cuporter 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/lib/cuporter/example_set_node.rb +0 -4
- data/lib/cuporter/feature_parser.rb +7 -5
- data/lib/cuporter/formatters/cuporter.css +9 -2
- data/lib/cuporter/formatters/html_node_writer.rb +4 -1
- data/lib/cuporter/node.rb +3 -16
- data/lib/cuporter/tag_list_node.rb +15 -0
- data/lib/cuporter/tag_report.rb +2 -2
- metadata +21 -19
- data/features/pretty_print.feature +0 -7
- data/features/step_definitions/cuporter_steps.rb +0 -8
- data/features/support/env.rb +0 -2
- data/spec/cuporter/example_set_node_spec.rb +0 -26
- data/spec/cuporter/feature_parser_spec.rb +0 -78
- data/spec/cuporter/functional/scenario_outlines_spec.rb +0 -431
- data/spec/cuporter/functional/single_feature_spec.rb +0 -65
- data/spec/cuporter/node_numberer_spec.rb +0 -80
- data/spec/cuporter/node_spec.rb +0 -81
- data/spec/cuporter/sort_node_spec.rb +0 -187
- data/spec/cuporter/support/functional/cli.rb +0 -10
- data/spec/cuporter/tag_list_node_spec.rb +0 -289
- data/spec/spec_helper.rb +0 -8
@@ -1,187 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Cuporter
|
4
|
-
describe Node do
|
5
|
-
context 'sorting' do
|
6
|
-
it 'defaults to order of addition' do
|
7
|
-
root = Node.new('root')
|
8
|
-
root.add_child(Node.new('zebra'))
|
9
|
-
root.add_child(Node.new('aardvark'))
|
10
|
-
|
11
|
-
root.names.should == %w[zebra aardvark]
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'sorts direct descendants' do
|
15
|
-
root = Node.new('root')
|
16
|
-
root.add_child(Node.new('zebra'))
|
17
|
-
root.add_child(Node.new('aardvark'))
|
18
|
-
|
19
|
-
root.sort_all_descendants!
|
20
|
-
root.names.should == %w[aardvark zebra]
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'sorts all descendants to an arbitrary depth, such as 6' do
|
24
|
-
root = Node.new('root')
|
25
|
-
zebra = Node.new("zebra")
|
26
|
-
apple = Node.new("apple")
|
27
|
-
zebra1 = Node.new("zebra1")
|
28
|
-
apple1 = Node.new("apple1")
|
29
|
-
zebra2 = Node.new("zebra2")
|
30
|
-
apple2 = Node.new("apple2")
|
31
|
-
zebra3 = Node.new("zebra3")
|
32
|
-
apple3 = Node.new("apple3")
|
33
|
-
zebra4 = Node.new("zebra4")
|
34
|
-
apple4 = Node.new("apple4")
|
35
|
-
zebra5 = Node.new("zebra5")
|
36
|
-
apple5 = Node.new("apple5")
|
37
|
-
|
38
|
-
zebra4.add_child(zebra5)
|
39
|
-
zebra4.add_child(apple5)
|
40
|
-
apple4.add_child(zebra5)
|
41
|
-
apple4.add_child(apple5)
|
42
|
-
|
43
|
-
zebra3.add_child(zebra4)
|
44
|
-
zebra3.add_child(apple4)
|
45
|
-
apple3.add_child(zebra4)
|
46
|
-
apple3.add_child(apple4)
|
47
|
-
|
48
|
-
zebra2.add_child(zebra3)
|
49
|
-
zebra2.add_child(apple3)
|
50
|
-
apple2.add_child(zebra3)
|
51
|
-
apple2.add_child(apple3)
|
52
|
-
|
53
|
-
zebra1.add_child(zebra2)
|
54
|
-
zebra1.add_child(apple2)
|
55
|
-
apple1.add_child(zebra2)
|
56
|
-
apple1.add_child(apple2)
|
57
|
-
|
58
|
-
zebra.add_child(zebra1)
|
59
|
-
zebra.add_child(apple1)
|
60
|
-
apple.add_child(zebra1)
|
61
|
-
apple.add_child(apple1)
|
62
|
-
|
63
|
-
root.add_child(zebra)
|
64
|
-
root.add_child(apple)
|
65
|
-
|
66
|
-
root.sort_all_descendants!
|
67
|
-
root.names.should == %w[apple zebra]
|
68
|
-
gen_1 = %w[apple1 zebra1]
|
69
|
-
root[:apple].names.should == gen_1
|
70
|
-
root[:zebra].names.should == gen_1
|
71
|
-
|
72
|
-
gen_2 = %w[apple2 zebra2]
|
73
|
-
root[:apple][:apple1].names.should == gen_2
|
74
|
-
root[:apple][:zebra1].names.should == gen_2
|
75
|
-
root[:zebra][:apple1].names.should == gen_2
|
76
|
-
root[:zebra][:zebra1].names.should == gen_2
|
77
|
-
|
78
|
-
gen_3 = %w[apple3 zebra3]
|
79
|
-
root[:apple][:apple1][:apple2].names.should == gen_3
|
80
|
-
root[:apple][:apple1][:zebra2].names.should == gen_3
|
81
|
-
root[:apple][:zebra1][:apple2].names.should == gen_3
|
82
|
-
root[:apple][:zebra1][:zebra2].names.should == gen_3
|
83
|
-
root[:zebra][:apple1][:apple2].names.should == gen_3
|
84
|
-
root[:zebra][:apple1][:zebra2].names.should == gen_3
|
85
|
-
root[:zebra][:zebra1][:apple2].names.should == gen_3
|
86
|
-
root[:zebra][:zebra1][:zebra2].names.should == gen_3
|
87
|
-
|
88
|
-
gen_4 = %w[apple4 zebra4]
|
89
|
-
root[:apple][:apple1][:apple2][:apple3].names.should == gen_4
|
90
|
-
root[:apple][:apple1][:apple2][:zebra3].names.should == gen_4
|
91
|
-
root[:apple][:apple1][:zebra2][:apple3].names.should == gen_4
|
92
|
-
root[:apple][:apple1][:zebra2][:zebra3].names.should == gen_4
|
93
|
-
|
94
|
-
root[:apple][:zebra1][:apple2][:apple3].names.should == gen_4
|
95
|
-
root[:apple][:zebra1][:apple2][:zebra3].names.should == gen_4
|
96
|
-
root[:apple][:zebra1][:zebra2][:apple3].names.should == gen_4
|
97
|
-
root[:apple][:zebra1][:zebra2][:zebra3].names.should == gen_4
|
98
|
-
|
99
|
-
root[:zebra][:apple1][:apple2][:apple3].names.should == gen_4
|
100
|
-
root[:zebra][:apple1][:apple2][:zebra3].names.should == gen_4
|
101
|
-
root[:zebra][:apple1][:zebra2][:apple3].names.should == gen_4
|
102
|
-
root[:zebra][:apple1][:zebra2][:zebra3].names.should == gen_4
|
103
|
-
|
104
|
-
root[:zebra][:zebra1][:apple2][:apple3].names.should == gen_4
|
105
|
-
root[:zebra][:zebra1][:apple2][:zebra3].names.should == gen_4
|
106
|
-
root[:zebra][:zebra1][:zebra2][:apple3].names.should == gen_4
|
107
|
-
root[:zebra][:zebra1][:zebra2][:zebra3].names.should == gen_4
|
108
|
-
|
109
|
-
gen_5 = %w[apple5 zebra5]
|
110
|
-
root[:apple][:apple1][:apple2][:apple3][:apple4].names.should == gen_5
|
111
|
-
root[:apple][:apple1][:apple2][:apple3][:zebra4].names.should == gen_5
|
112
|
-
root[:apple][:apple1][:apple2][:apple3][:apple4].names.should == gen_5
|
113
|
-
root[:apple][:apple1][:apple2][:apple3][:zebra4].names.should == gen_5
|
114
|
-
root[:apple][:apple1][:apple2][:zebra3][:apple4].names.should == gen_5
|
115
|
-
root[:apple][:apple1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
116
|
-
root[:apple][:apple1][:apple2][:zebra3][:apple4].names.should == gen_5
|
117
|
-
root[:apple][:apple1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
118
|
-
|
119
|
-
root[:apple][:apple1][:zebra2][:apple3][:apple4].names.should == gen_5
|
120
|
-
root[:apple][:apple1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
121
|
-
root[:apple][:apple1][:zebra2][:apple3][:apple4].names.should == gen_5
|
122
|
-
root[:apple][:apple1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
123
|
-
root[:apple][:apple1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
124
|
-
root[:apple][:apple1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
125
|
-
root[:apple][:apple1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
126
|
-
root[:apple][:apple1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
127
|
-
|
128
|
-
root[:apple][:zebra1][:apple2][:apple3][:apple4].names.should == gen_5
|
129
|
-
root[:apple][:zebra1][:apple2][:apple3][:zebra4].names.should == gen_5
|
130
|
-
root[:apple][:zebra1][:apple2][:apple3][:apple4].names.should == gen_5
|
131
|
-
root[:apple][:zebra1][:apple2][:apple3][:zebra4].names.should == gen_5
|
132
|
-
root[:apple][:zebra1][:apple2][:zebra3][:apple4].names.should == gen_5
|
133
|
-
root[:apple][:zebra1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
134
|
-
root[:apple][:zebra1][:apple2][:zebra3][:apple4].names.should == gen_5
|
135
|
-
root[:apple][:zebra1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
136
|
-
|
137
|
-
root[:apple][:zebra1][:zebra2][:apple3][:apple4].names.should == gen_5
|
138
|
-
root[:apple][:zebra1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
139
|
-
root[:apple][:zebra1][:zebra2][:apple3][:apple4].names.should == gen_5
|
140
|
-
root[:apple][:zebra1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
141
|
-
root[:apple][:zebra1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
142
|
-
root[:apple][:zebra1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
143
|
-
root[:apple][:zebra1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
144
|
-
root[:apple][:zebra1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
145
|
-
|
146
|
-
|
147
|
-
root[:zebra][:apple1][:apple2][:apple3][:apple4].names.should == gen_5
|
148
|
-
root[:zebra][:apple1][:apple2][:apple3][:zebra4].names.should == gen_5
|
149
|
-
root[:zebra][:apple1][:apple2][:apple3][:apple4].names.should == gen_5
|
150
|
-
root[:zebra][:apple1][:apple2][:apple3][:zebra4].names.should == gen_5
|
151
|
-
root[:zebra][:apple1][:apple2][:zebra3][:apple4].names.should == gen_5
|
152
|
-
root[:zebra][:apple1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
153
|
-
root[:zebra][:apple1][:apple2][:zebra3][:apple4].names.should == gen_5
|
154
|
-
root[:zebra][:apple1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
155
|
-
|
156
|
-
root[:zebra][:apple1][:zebra2][:apple3][:apple4].names.should == gen_5
|
157
|
-
root[:zebra][:apple1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
158
|
-
root[:zebra][:apple1][:zebra2][:apple3][:apple4].names.should == gen_5
|
159
|
-
root[:zebra][:apple1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
160
|
-
root[:zebra][:apple1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
161
|
-
root[:zebra][:apple1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
162
|
-
root[:zebra][:apple1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
163
|
-
root[:zebra][:apple1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
164
|
-
|
165
|
-
root[:zebra][:zebra1][:apple2][:apple3][:apple4].names.should == gen_5
|
166
|
-
root[:zebra][:zebra1][:apple2][:apple3][:zebra4].names.should == gen_5
|
167
|
-
root[:zebra][:zebra1][:apple2][:apple3][:apple4].names.should == gen_5
|
168
|
-
root[:zebra][:zebra1][:apple2][:apple3][:zebra4].names.should == gen_5
|
169
|
-
root[:zebra][:zebra1][:apple2][:zebra3][:apple4].names.should == gen_5
|
170
|
-
root[:zebra][:zebra1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
171
|
-
root[:zebra][:zebra1][:apple2][:zebra3][:apple4].names.should == gen_5
|
172
|
-
root[:zebra][:zebra1][:apple2][:zebra3][:zebra4].names.should == gen_5
|
173
|
-
|
174
|
-
root[:zebra][:zebra1][:zebra2][:apple3][:apple4].names.should == gen_5
|
175
|
-
root[:zebra][:zebra1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
176
|
-
root[:zebra][:zebra1][:zebra2][:apple3][:apple4].names.should == gen_5
|
177
|
-
root[:zebra][:zebra1][:zebra2][:apple3][:zebra4].names.should == gen_5
|
178
|
-
root[:zebra][:zebra1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
179
|
-
root[:zebra][:zebra1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
180
|
-
root[:zebra][:zebra1][:zebra2][:zebra3][:apple4].names.should == gen_5
|
181
|
-
root[:zebra][:zebra1][:zebra2][:zebra3][:zebra4].names.should == gen_5
|
182
|
-
|
183
|
-
end
|
184
|
-
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
@@ -1,289 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Cuporter
|
4
|
-
describe TagListNode do
|
5
|
-
context 'new tag list node' do
|
6
|
-
let(:tag_list_node) {TagListNode.new("name", []) }
|
7
|
-
it 'is a node' do
|
8
|
-
tag_list_node.should be_a Node
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'has an empty tag list' do
|
12
|
-
tag_list_node.should_not have_tags
|
13
|
-
end
|
14
|
-
context 'with tags' do
|
15
|
-
it 'should have tags' do
|
16
|
-
tag_list_node = TagListNode.new("name", %w[tag_1 tag_2])
|
17
|
-
tag_list_node.should have_tags
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'children' do
|
23
|
-
context 'with universal tags but none of their own' do
|
24
|
-
it 'child inherits one tag from parent' do
|
25
|
-
tag_list_node = TagListNode.new("parent", ["p_tag_1"])
|
26
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", []))
|
27
|
-
|
28
|
-
tag_list_node.children.size.should == 1
|
29
|
-
tag_list_node.children.first.name.should == "p_tag_1"
|
30
|
-
|
31
|
-
tag_list_node[:p_tag_1].children.size.should == 1
|
32
|
-
tag_list_node[:p_tag_1].children.first.name.should == "child"
|
33
|
-
|
34
|
-
end
|
35
|
-
it 'child inherits 2 tags from parent' do
|
36
|
-
tag_list_node = TagListNode.new("parent", ["p_tag_1", "p_tag_2"])
|
37
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", []))
|
38
|
-
|
39
|
-
tag_list_node.children.size.should == 2
|
40
|
-
tag_list_node.children.first.name.should == "p_tag_1"
|
41
|
-
tag_list_node.children.last.name.should == "p_tag_2"
|
42
|
-
|
43
|
-
tag_list_node[:p_tag_1].children.size.should == 1
|
44
|
-
tag_list_node[:p_tag_1].children.first.name.should == "child"
|
45
|
-
|
46
|
-
tag_list_node[:p_tag_2].children.size.should == 1
|
47
|
-
tag_list_node[:p_tag_2].children.first.name.should == "child"
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
context 'without universal tags but some of their own' do
|
52
|
-
let(:tag_list_node) {TagListNode.new("parent", []) }
|
53
|
-
it 'child has one tag' do
|
54
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", ["c_tag_1"]))
|
55
|
-
|
56
|
-
tag_list_node.children.size.should == 1
|
57
|
-
tag_list_node.children.first.name.should == "c_tag_1"
|
58
|
-
|
59
|
-
tag_list_node[:c_tag_1].children.size.should == 1
|
60
|
-
tag_list_node[:c_tag_1].children.first.name.should == "child"
|
61
|
-
end
|
62
|
-
it 'child has two tags' do
|
63
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", ["c_tag_1", "c_tag_2"]))
|
64
|
-
|
65
|
-
tag_list_node.children.size.should == 2
|
66
|
-
tag_list_node.children.first.name.should == "c_tag_1"
|
67
|
-
tag_list_node.children.last.name.should == "c_tag_2"
|
68
|
-
|
69
|
-
tag_list_node[:c_tag_1].children.size.should == 1
|
70
|
-
tag_list_node[:c_tag_1].children.first.name.should == "child"
|
71
|
-
|
72
|
-
tag_list_node[:c_tag_2].children.size.should == 1
|
73
|
-
tag_list_node[:c_tag_2].children.first.name.should == "child"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
context 'with universal tags and their own tags' do
|
77
|
-
let(:tag_list_node) {TagListNode.new("parent",%w[p_tag_1 p_tag_2]) }
|
78
|
-
it "2 universal tags and 2 child tags" do
|
79
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", ["c_tag_1", "c_tag_2"]))
|
80
|
-
|
81
|
-
tag_list_node.children.size.should == 4
|
82
|
-
tag_list_node.children.collect do |c|
|
83
|
-
c.name
|
84
|
-
end.should == %w[p_tag_1 p_tag_2 c_tag_1 c_tag_2]
|
85
|
-
|
86
|
-
tag_list_node[:p_tag_1].children.size.should == 1
|
87
|
-
tag_list_node[:p_tag_1].children.first.name.should == "child"
|
88
|
-
|
89
|
-
tag_list_node[:p_tag_2].children.size.should == 1
|
90
|
-
tag_list_node[:p_tag_2].children.first.name.should == "child"
|
91
|
-
|
92
|
-
tag_list_node[:c_tag_1].children.size.should == 1
|
93
|
-
tag_list_node[:c_tag_1].children.first.name.should == "child"
|
94
|
-
|
95
|
-
tag_list_node[:c_tag_2].children.size.should == 1
|
96
|
-
tag_list_node[:c_tag_2].children.first.name.should == "child"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
context 'with no tags at all' do
|
100
|
-
it 'top node has no children' do
|
101
|
-
tag_list_node = TagListNode.new("parent", [])
|
102
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child", []))
|
103
|
-
|
104
|
-
tag_list_node.should_not have_children
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'second child with preexisting tag' do
|
111
|
-
it 'top node has 1 child and 2 grandchildren' do
|
112
|
-
tag_list_node = TagListNode.new("parent", ["p_tag_1"])
|
113
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child_1", []))
|
114
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child_2", []))
|
115
|
-
|
116
|
-
tag_list_node.children.size.should == 1
|
117
|
-
tag_list_node.children[0].name.should == "p_tag_1"
|
118
|
-
|
119
|
-
tag_list_node[:p_tag_1].children.size.should == 2
|
120
|
-
tag_list_node[:p_tag_1].children[0].name.should == "child_1"
|
121
|
-
tag_list_node[:p_tag_1].children[1].name.should == "child_2"
|
122
|
-
end
|
123
|
-
|
124
|
-
it '2 child nodes with 1 universal tag and 2 child tags' do
|
125
|
-
tag_list_node = TagListNode.new("parent", ["p_tag_1"])
|
126
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child_1", ["c_tag_1"]))
|
127
|
-
tag_list_node.add_to_tag_nodes(TagListNode.new("child_2", ["c_tag_1", "c_tag_2"]))
|
128
|
-
|
129
|
-
tag_list_node.children.size.should == 3
|
130
|
-
tag_list_node.children[0].name.should == "p_tag_1"
|
131
|
-
tag_list_node.children[1].name.should == "c_tag_1"
|
132
|
-
tag_list_node.children[2].name.should == "c_tag_2"
|
133
|
-
|
134
|
-
tag_list_node[:p_tag_1].children.size.should == 2
|
135
|
-
tag_list_node[:p_tag_1].children[0].name.should == "child_1"
|
136
|
-
tag_list_node[:p_tag_1].children[1].name.should == "child_2"
|
137
|
-
|
138
|
-
tag_list_node[:c_tag_1].children.size.should == 2
|
139
|
-
tag_list_node[:c_tag_1].children[0].name.should == "child_1"
|
140
|
-
tag_list_node[:c_tag_1].children[1].name.should == "child_2"
|
141
|
-
|
142
|
-
tag_list_node[:c_tag_2].children.size.should == 1
|
143
|
-
tag_list_node[:c_tag_2].children[0].name.should == "child_2"
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context 'child is tag list node' do
|
148
|
-
context '1 universal tag on parent and no universal tags on child' do
|
149
|
-
context "child must be initialized with parent's universal tags" do
|
150
|
-
it 'top node has no children' do
|
151
|
-
p = TagListNode.new("parent", ["p_tag_1"])
|
152
|
-
c = TagListNode.new("child", [] )
|
153
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_1", []))
|
154
|
-
|
155
|
-
p.should_not have_children
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'all leaf nodes are under parent universal tag' do
|
159
|
-
p = TagListNode.new("parent", ["p_tag_1"])
|
160
|
-
c = TagListNode.new("child", p.tags)
|
161
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_1", []))
|
162
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_2", []))
|
163
|
-
p.merge(c)
|
164
|
-
|
165
|
-
p.children.size.should == 1
|
166
|
-
p.children[0].name.should == "p_tag_1"
|
167
|
-
|
168
|
-
p[:p_tag_1].children.size.should == 1
|
169
|
-
p[:p_tag_1].children[0].name.should == "child"
|
170
|
-
|
171
|
-
p[:p_tag_1][:child].children.size.should == 2
|
172
|
-
p[:p_tag_1][:child].children[0].name.should == "leaf_1"
|
173
|
-
p[:p_tag_1][:child].children[1].name.should == "leaf_2"
|
174
|
-
|
175
|
-
p[:p_tag_1][:child][:leaf_1].should_not have_children
|
176
|
-
p[:p_tag_1][:child][:leaf_2].should_not have_children
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
context '1 universal tag on parent and 1 universal tag on child' do
|
182
|
-
it "2 tags have 2 leaf nodes" do
|
183
|
-
p = TagListNode.new("parent", ["p_tag_1"])
|
184
|
-
c = TagListNode.new("child", p.tags | ["c_tag_1"])
|
185
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_1", []))
|
186
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_2", []))
|
187
|
-
p.merge(c)
|
188
|
-
|
189
|
-
p.children.size.should == 2
|
190
|
-
p.children[0].name.should == "p_tag_1"
|
191
|
-
p.children[1].name.should == "c_tag_1"
|
192
|
-
p[:p_tag_1].children.size.should == 1
|
193
|
-
p[:p_tag_1].children[0].name.should == "child"
|
194
|
-
p[:c_tag_1].children.size.should == 1
|
195
|
-
p[:c_tag_1].children[0].name.should == "child"
|
196
|
-
|
197
|
-
p[:p_tag_1][:child].children.size.should == 2
|
198
|
-
p[:p_tag_1][:child].children[0].name.should == "leaf_1"
|
199
|
-
p[:p_tag_1][:child].children[1].name.should == "leaf_2"
|
200
|
-
|
201
|
-
p[:c_tag_1][:child].children.size.should == 2
|
202
|
-
p[:c_tag_1][:child].children[0].name.should == "leaf_1"
|
203
|
-
p[:c_tag_1][:child].children[1].name.should == "leaf_2"
|
204
|
-
|
205
|
-
p[:p_tag_1][:child][:leaf_1].should_not have_children
|
206
|
-
p[:p_tag_1][:child][:leaf_2].should_not have_children
|
207
|
-
|
208
|
-
p[:c_tag_1][:child][:leaf_1].should_not have_children
|
209
|
-
p[:c_tag_1][:child][:leaf_2].should_not have_children
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
context '1 universal tag on parent and 1 tag on 1 leaf' do
|
214
|
-
it "1 tag has 1 leaf node, the other has 2 leaf nodes" do
|
215
|
-
p = TagListNode.new("parent", ["p_tag_1"])
|
216
|
-
c = TagListNode.new("child", p.tags )
|
217
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_1", []))
|
218
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_2", ["l_tag_1"]))
|
219
|
-
p.merge(c)
|
220
|
-
|
221
|
-
p.children.size.should == 2
|
222
|
-
p.children[0].name.should == "p_tag_1"
|
223
|
-
p.children[1].name.should == "l_tag_1"
|
224
|
-
p[:p_tag_1].children.size.should == 1
|
225
|
-
p[:p_tag_1].children[0].name.should == "child"
|
226
|
-
p[:l_tag_1].children.size.should == 1
|
227
|
-
p[:l_tag_1].children[0].name.should == "child"
|
228
|
-
|
229
|
-
p[:p_tag_1][:child].children.size.should == 2
|
230
|
-
p[:p_tag_1][:child].children[0].name.should == "leaf_1"
|
231
|
-
p[:p_tag_1][:child].children[1].name.should == "leaf_2"
|
232
|
-
|
233
|
-
p[:l_tag_1][:child].children.size.should == 1
|
234
|
-
p[:l_tag_1][:child].children[0].name.should == "leaf_2"
|
235
|
-
|
236
|
-
p[:p_tag_1][:child][:leaf_1].should_not have_children
|
237
|
-
p[:p_tag_1][:child][:leaf_2].should_not have_children
|
238
|
-
|
239
|
-
p[:l_tag_1][:child][:leaf_2].should_not have_children
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
context '1 universal tag on parent 1 universal tag on child 1 tag on leaf' do
|
244
|
-
it "2 tags with 2 leaves, 1 tag with 1 leaf" do
|
245
|
-
p = TagListNode.new("parent", ["p_tag_1"])
|
246
|
-
c = TagListNode.new("child", p.tags | ["c_tag_1"])
|
247
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_1", []))
|
248
|
-
c.add_to_tag_nodes(TagListNode.new("leaf_2", ["l_tag_1"]))
|
249
|
-
p.merge(c)
|
250
|
-
|
251
|
-
p.children.size.should == 3
|
252
|
-
p.children[0].name.should == "p_tag_1"
|
253
|
-
p.children[1].name.should == "c_tag_1"
|
254
|
-
p.children[2].name.should == "l_tag_1"
|
255
|
-
|
256
|
-
p[:p_tag_1].children.size.should == 1
|
257
|
-
p[:p_tag_1].children[0].name.should == "child"
|
258
|
-
|
259
|
-
p[:c_tag_1].children.size.should == 1
|
260
|
-
p[:c_tag_1].children[0].name.should == "child"
|
261
|
-
|
262
|
-
p[:l_tag_1].children.size.should == 1
|
263
|
-
p[:l_tag_1].children[0].name.should == "child"
|
264
|
-
|
265
|
-
p[:p_tag_1][:child].children.size.should == 2
|
266
|
-
p[:p_tag_1][:child].children[0].name.should == "leaf_1"
|
267
|
-
p[:p_tag_1][:child].children[1].name.should == "leaf_2"
|
268
|
-
|
269
|
-
p[:c_tag_1][:child].children.size.should == 2
|
270
|
-
p[:c_tag_1][:child].children[0].name.should == "leaf_1"
|
271
|
-
p[:c_tag_1][:child].children[1].name.should == "leaf_2"
|
272
|
-
|
273
|
-
p[:l_tag_1][:child].children.size.should == 1
|
274
|
-
p[:l_tag_1][:child].children[0].name.should == "leaf_2"
|
275
|
-
|
276
|
-
p[:p_tag_1][:child][:leaf_1].should_not have_children
|
277
|
-
p[:p_tag_1][:child][:leaf_2].should_not have_children
|
278
|
-
|
279
|
-
p[:c_tag_1][:child][:leaf_1].should_not have_children
|
280
|
-
p[:c_tag_1][:child][:leaf_2].should_not have_children
|
281
|
-
|
282
|
-
p[:l_tag_1][:child][:leaf_2].should_not have_children
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
end
|
289
|
-
end
|