spec/integration/memory_spec.rb in activeadmin-0.6.0 vs spec/integration/memory_spec.rb in activeadmin-0.6.1
- old
+ new
@@ -9,16 +9,17 @@
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.start
+ GC.disable if previously_disabled
count_instances_of(klass).should <= count
end
end
it_should_not_leak ActiveAdmin::Namespace