Skip to content

Commit a367208

Browse files
committed
added tests (that fail)
1 parent 75fba24 commit a367208

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/label_spec.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)