Permalink
Browse files

Added pending specs which describe the memory leak. #170

  • Loading branch information...
1 parent 061b769 commit b5ddbf8316ebda3b741a8a3243ed24e3f792d6a2 @gregbell gregbell committed Sep 22, 2011
Showing with 38 additions and 0 deletions.
  1. +38 −0 spec/integration/memory_spec.rb
@@ -0,0 +1,38 @@
+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

0 comments on commit b5ddbf8

Please sign in to comment.