Sha256: e5ba0e3167f0f35a8fd57b58a6b298fb00ffb7aa6add3511aa730d726b7d29f1

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

# These tests show the memory leak that is currently in Active Admin. They
# are all marked as pending until they pass. To work on them, comment out the
# pending method call in #it_should_not_leak
describe "Memory Leak" do

  def count_instances_of(klass)
    ObjectSpace.each_object(klass) { }
  end

  def self.it_should_not_leak(klass)
    it "should not leak #{klass}" do
      previously_disabled = GC.enable # returns true if the garbage collector was disabled
      GC.start
      count = count_instances_of(klass)

      load_defaults!

      GC.start
      GC.disable if previously_disabled
      expect(count_instances_of(klass)).to be <= count
    end
  end

  it_should_not_leak ActiveAdmin::Namespace
  it_should_not_leak ActiveAdmin::Resource

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_administration-0.0.3 spec/integration/memory_spec.rb
activeadministration-0.0.2 spec/integration/memory_spec.rb
active_administration-0.0.2 spec/integration/memory_spec.rb
activeadministration-0.0.1 spec/integration/memory_spec.rb
active_administration-0.0.1 spec/integration/memory_spec.rb