Skip to content

Instantly share code, notes, and snippets.

@bkeepers
Created July 29, 2008 19:47
Show Gist options
  • Save bkeepers/3157 to your computer and use it in GitHub Desktop.
Save bkeepers/3157 to your computer and use it in GitHub Desktop.
def test_invalidate_tree
r1 = Category.create
r2 = Category.create
r3 = Category.create
r4 = Category.create
nodes = [r1, r2, r3, r4]
r2.move_to_child_of(r1)
nodes.each(&:reload)
assert Category.valid?
r3.move_to_child_of(r1)
nodes.each(&:reload)
assert Category.valid?
r4.move_to_child_of(r2)
nodes.each(&:reload)
assert Category.valid?
puts r1.children.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment