Skip to content

Instantly share code, notes, and snippets.

@bkeepers
Created Jul 29, 2008
Embed
What would you like to do?
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