File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,17 @@ def children_name_and_order
277277 d . self_and_siblings . collect ( &:sort_order ) . should == [ 0 , 1 , 2 , 3 ]
278278 end
279279
280- context "#add_sibling" do
280+ context '#add_sibling' do
281+ it 'works on root nodes' do
282+ l = { }
283+ ( :a ..:z ) . to_a . shuffle . each do |ea |
284+ l [ ea ] = Label . create! ( name : ea . to_s )
285+ end
286+ l [ :a ] . add_sibling ( l [ :b ] )
287+ l [ :a ] . siblings_after . should include ( l [ :b ] )
288+ l [ :a ] . siblings_before . should_not include ( l [ :b ] )
289+ end
290+
281291 it "should move a node before another node which has an uninitialized sort_order" do
282292 f = Label . find_or_create_by_path %w( a b c d e fa )
283293 f0 = f . prepend_sibling ( Label . new ( :name => "fb" ) ) # < not alpha sort, so name shouldn't matter
You can’t perform that action at this time.
0 commit comments