Sha256: 3eeb15a7c62207f7a23668623da75ad9d38ba19b93f5dd3fbd461c572a344be9
Contents?: true
Size: 1 KB
Versions: 10
Compression:
Stored size: 1 KB
Contents
class LeakDetector def initialize @did_dealloc = false end def did_dealloc(notification) @did_dealloc = true end def did_dealloc? @did_dealloc end end describe "Memory leaks" do tests MemoryLeakController def controller unless @controller root = UIViewController.new @controller = UINavigationController.alloc.initWithRootViewController(root) end @controller end it "should dealloc after being popped from UINavigationController" do detector = LeakDetector.new memory_leak = MemoryLeakController.new NSNotificationCenter.defaultCenter.addObserver(detector, selector: :'did_dealloc:', name: MemoryLeakController::DidDeallocNotification, object: memory_leak) self.controller.pushViewController(memory_leak, animated: false) memory_leak = nil wait 1 do self.controller.popViewControllerAnimated(false) wait 1 do detector.did_dealloc?.should == true end end end end
Version data entries
10 entries across 10 versions & 1 rubygems