Sha256: dec8b5b82f8ef9aaf974d60e48f4ba409eb4ec652f6b8fac109ccac06f153dfc
Contents?: true
Size: 522 Bytes
Versions: 13
Compression:
Stored size: 522 Bytes
Contents
require 'spec_helper' describe ClosureTree::HierarchyMaintenance do describe '.rebuild!' do it 'rebuild tree' do 20.times do |counter| Metal.create(:value => "Nitro-#{counter}", parent: Metal.all.sample) end hierarchy_count = MetalHierarchy.count expect(hierarchy_count).to be > (20*2)-1 # shallowest-possible case, where all children use the first root MetalHierarchy.delete_all Metal.rebuild! expect(MetalHierarchy.count).to eq(hierarchy_count) end end end
Version data entries
13 entries across 13 versions & 1 rubygems