Sha256: 46c59dcf14c42aff7fe2f0ec5744c8cad0cfefa5dc53e5ea8c74b74d2db81f83

Contents?: true

Size: 749 Bytes

Versions: 13

Compression:

Stored size: 749 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)
    count = 0

    ObjectSpace.each_object do |o|
      if o.class == klass
        count += 1
      end
    end

    count
  end

  def self.it_should_not_leak(klass)
    it "should not leak #{klass}" do
      pending

      GC.start

      count = count_instances_of(klass)

      load_defaults!
      GC.start

      count_instances_of(klass).should == count
    end
  end

  it_should_not_leak ActiveAdmin::Namespace
  it_should_not_leak ActiveAdmin::Resource

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
activeadmin-0.4.4 spec/integration/memory_spec.rb
activeadmin-0.4.3 spec/integration/memory_spec.rb
activeadmin-0.4.2 spec/integration/memory_spec.rb
activeadmin-0.4.1 spec/integration/memory_spec.rb
activeadmin-0.4.0 spec/integration/memory_spec.rb
andrewroth_activeadmin-0.3.4.4 spec/integration/memory_spec.rb
andrewroth_activeadmin-0.3.4.3 spec/integration/memory_spec.rb
andrewroth_activeadmin-0.3.4.2 spec/integration/memory_spec.rb
andrewroth_activeadmin-0.3.4.1 spec/integration/memory_spec.rb
andrewroth_activeadmin-0.3.4 spec/integration/memory_spec.rb
activeadmin-0.3.4 spec/integration/memory_spec.rb
activeadmin-0.3.3 spec/integration/memory_spec.rb
activeadmin-0.3.2 spec/integration/memory_spec.rb