Sha256: 98620af5b41457b6a35cd27bc5004a95882101b96dfc279acb8ec6feab06c922
Contents?: true
Size: 1.1 KB
Versions: 7
Compression:
Stored size: 1.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 puts("=============== memory_leak_spec.rb line #{__LINE__} ===============") 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 p memory_leak.view 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
7 entries across 7 versions & 1 rubygems