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

Version Path
closure_tree-6.6.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.5.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.4.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.3.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.2.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.1.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.0.0 spec/hierarchy_maintenance_spec.rb
closure_tree-6.0.0.gamma spec/hierarchy_maintenance_spec.rb
closure_tree-6.0.0.alpha spec/hierarchy_maintenance_spec.rb
closure_tree-5.2.0 spec/hierarchy_maintenance_spec.rb
closure_tree-5.1.1 spec/hierarchy_maintenance_spec.rb
closure_tree-5.1.0 spec/hierarchy_maintenance_spec.rb
closure_tree-5.0.0 spec/hierarchy_maintenance_spec.rb