1414class SpecializedTreeNode < Tree ::TreeNode ; end
1515
1616describe Tree do
17- shared_examples_for 'any detached node' do
18- it 'does not equal "Object.new"' do
19- expect ( tree ) . not_to eq ( Object . new )
20- end
21-
22- it 'does not equal 1 or any other fixnum' do
23- expect ( tree ) . not_to eq ( 1 )
24- end
25-
26- it 'identifies itself as a root node' do
27- expect ( tree . root? ) . to be ( true )
28- end
29-
30- it 'does not have a parent node' do
31- expect ( tree . parent ) . to be_nil
32- end
33- end
3417
3518 describe '#initialize with empty name and nil content' do
3619 let ( :tree ) { Tree ::TreeNode . new ( '' ) }
@@ -43,7 +26,7 @@ class SpecializedTreeNode < Tree::TreeNode; end
4326 expect ( tree . content ) . to be_nil
4427 end
4528
46- it_behaves_like 'any detached node'
29+ it_behaves_like 'detached node'
4730 end
4831
4932 describe "#initialize with name 'A' and nil content" do
@@ -57,7 +40,7 @@ class SpecializedTreeNode < Tree::TreeNode; end
5740 expect ( tree . content ) . to be_nil
5841 end
5942
60- it_behaves_like 'any detached node'
43+ it_behaves_like 'detached node'
6144 end
6245
6346 describe "#initialize with node name 'A' and some content" do
@@ -72,7 +55,7 @@ class SpecializedTreeNode < Tree::TreeNode; end
7255 expect ( tree . content ) . to eq ( sample )
7356 end
7457
75- it_behaves_like 'any detached node'
58+ it_behaves_like 'detached node'
7659 end
7760
7861 describe 'comparison' do
@@ -117,21 +100,11 @@ class SpecializedTreeNode < Tree::TreeNode; end
117100 end
118101 end
119102
120- shared_examples_for 'any cloned node' do
121- it 'is equal to the original' do
122- expect ( clone ) . to eq tree
123- end
124-
125- it 'is not identical to the original' do
126- expect ( clone ) . not_to be tree
127- end
128- end
129-
130103 describe '#detached_copy' , 'Without content' do
131104 let ( :tree ) { Tree ::TreeNode . new ( 'A' , nil ) }
132105 let ( :clone ) { tree . detached_copy }
133106
134- it_behaves_like 'any cloned node'
107+ it_behaves_like 'cloned node'
135108 end
136109
137110 describe '#detached_copy with clonable content' do
@@ -146,7 +119,7 @@ class SpecializedTreeNode < Tree::TreeNode; end
146119 expect ( clone . content ) . not_to be tree . content
147120 end
148121
149- it_behaves_like 'any cloned node'
122+ it_behaves_like 'cloned node'
150123 end
151124
152125 describe '#detached_copy with unclonable content' do
@@ -157,7 +130,7 @@ class SpecializedTreeNode < Tree::TreeNode; end
157130 expect ( clone . content ) . to be tree . content
158131 end
159132
160- it_behaves_like 'any cloned node'
133+ it_behaves_like 'cloned node'
161134 end
162135
163136 describe '#detached_copy with false as content' do
@@ -168,6 +141,6 @@ class SpecializedTreeNode < Tree::TreeNode; end
168141 expect ( clone . content ) . to be tree . content
169142 end
170143
171- it_behaves_like 'any cloned node'
144+ it_behaves_like 'cloned node'
172145 end
173146end
0 commit comments