+
+ # cancelling the most recent toplevel container should
+ # reprioritize all of its descendants (except the shared
+ # grandchild) to zero
+ toplevel_crs[2].update_attributes!(priority: 0)
+ (parents + children + grandchildren + [shared_grandchild]).map(&:reload)
+ assert_operator 0, :==, parents[2].priority
+ assert_operator 0, :==, children[2].priority
+ assert_operator 0, :==, grandchildren[2].priority
+ assert_operator shared_grandchild.priority, :==, grandchildren[0].priority
+
+ # cancel a child request, the parent should be > 0 but
+ # the child and grandchild go to 0.
+ children_crs[1].update_attributes!(priority: 0)
+ (parents + children + grandchildren + [shared_grandchild]).map(&:reload)
+ assert_operator 0, :<, parents[1].priority
+ assert_operator parents[0].priority, :>, parents[1].priority
+ assert_operator 0, :==, children[1].priority
+ assert_operator 0, :==, grandchildren[1].priority
+ assert_operator shared_grandchild.priority, :==, grandchildren[0].priority
+
+ # update the parent, it should get a higher priority but the children and
+ # grandchildren should remain at 0
+ toplevel_crs[1].update_attributes!(priority: 6)
+ (parents + children + grandchildren + [shared_grandchild]).map(&:reload)
+ assert_operator 0, :<, parents[1].priority
+ assert_operator parents[0].priority, :<, parents[1].priority
+ assert_operator 0, :==, children[1].priority
+ assert_operator 0, :==, grandchildren[1].priority
+ assert_operator shared_grandchild.priority, :==, grandchildren[0].priority