@@ -499,12 +499,12 @@ def assert_parent_and_children
499499
500500 context 'hash_tree' do
501501 before :each do
502- @b = tag_class . find_or_create_by_path %w( a b )
502+ @d1 = tag_class . find_or_create_by_path %w( a b c1 d1 )
503+ @c1 = @d1 . parent
504+ @b = @c1 . parent
503505 @a = @b . parent
504506 @a2 = tag_class . create ( name : 'a2' )
505507 @b2 = tag_class . find_or_create_by_path %w( a b2 )
506- @d1 = @b . find_or_create_by_path %w( c1 d1 )
507- @c1 = @d1 . parent
508508 @c3 = tag_class . find_or_create_by_path %w( a3 b3 c3 )
509509 @b3 = @c3 . parent
510510 @a3 = @b3 . parent
@@ -586,22 +586,22 @@ def assert_parent_and_children
586586 expect ( @b . hash_tree ( limit_depth : 0 ) ) . to eq ( { } )
587587 end
588588 it 'limit_depth 1' do
589- expect ( @b . hash_tree ( limit_depth : 1 ) ) . to eq ( { @b => { } } )
589+ expect ( @b . hash_tree ( limit_depth : 1 ) ) . to eq ( @two_tree [ @a ] . slice ( @b ) )
590590 end
591591 it 'limit_depth 2' do
592- expect ( @b . hash_tree ( limit_depth : 2 ) ) . to eq ( { @b => { @c1 => { } , @c2 => { } } } )
592+ expect ( @b . hash_tree ( limit_depth : 2 ) ) . to eq ( @three_tree [ @a ] . slice ( @b ) )
593593 end
594594 it 'limit_depth 3' do
595- expect ( @b . hash_tree ( limit_depth : 3 ) ) . to eq ( { @b => { @c1 => { @d1 => { } } , @c2 => { @d2 => { } } } } )
595+ expect ( @b . hash_tree ( limit_depth : 3 ) ) . to eq ( @full_tree [ @a ] . slice ( @b ) )
596596 end
597597 it 'no limit from subsubroot' do
598- expect ( @c1 . hash_tree ) . to eq ( { @c1 => { @d1 => { } } } )
598+ expect ( @c1 . hash_tree ) . to eq ( @full_tree [ @a ] [ @b ] . slice ( @c1 ) )
599599 end
600600 it 'no limit from subroot' do
601- expect ( @b . hash_tree ) . to eq ( { @b => { @c1 => { @d1 => { } } , @c2 => { @d2 => { } } } } )
601+ expect ( @b . hash_tree ) . to eq ( @full_tree [ @a ] . slice ( @b ) )
602602 end
603603 it 'no limit from root' do
604- expect ( @a . hash_tree . merge ( @a2 . hash_tree ) ) . to eq ( @full_tree )
604+ expect ( @a . hash_tree . merge ( @a2 . hash_tree ) ) . to eq ( @full_tree . slice ( @a , @a2 ) )
605605 end
606606 end
607607
0 commit comments