Skip to content

Commit

Permalink
Failing tests when moving to a node with uninitialized sort_order
Browse files Browse the repository at this point in the history
Harder failing tests when moving to a node with uninitialized sort_order
  • Loading branch information
elhoyos committed Sep 3, 2012
1 parent c85a605 commit 2f2c53c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/fixtures/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ e2:
parent: d2
sort_order: 1

f3:
name: f3

f4:
name: f4
20 changes: 20 additions & 0 deletions spec/label_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@ def nuke_db
labels(:c2).self_and_siblings.to_a.should == [labels(:b1), labels(:c2), labels(:b2)]
end

it "should move a node before another node which has an uninitialized sort_order" do
labels(:f3).ancestry_path.should == %w{f3}
labels(:e2).children << labels(:f3)
labels(:f3).reload.ancestry_path.should == %w{a1 b2 c2 d2 e2 f3}
labels(:f3).self_and_siblings.to_a.should == [labels(:f3)]
labels(:f3).prepend_sibling labels(:f4)
labels(:f3).siblings_before.to_a.should == [labels(:f4)]
labels(:f3).self_and_siblings.to_a.should == [labels(:f4), labels(:f3)]
end

it "should move a node after another node which has an uninitialized sort_order" do
labels(:f3).ancestry_path.should == %w{f3}
labels(:e2).children << labels(:f3)
labels(:f3).reload.ancestry_path.should == %w{a1 b2 c2 d2 e2 f3}
labels(:f3).self_and_siblings.to_a.should == [labels(:f3)]
labels(:f3).append_sibling labels(:f4)
labels(:f3).siblings_after.to_a.should == [labels(:f4)]
labels(:f3).self_and_siblings.to_a.should == [labels(:f3), labels(:f4)]
end

it "should move a node after another node" do
labels(:c2).ancestry_path.should == %w{a1 b2 c2}
labels(:b2).append_sibling(labels(:c2), false)
Expand Down

0 comments on commit 2f2c53c

Please sign in to comment.