{"action":"created","comment":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments/51515832","id":51515832,"diff_hunk":"@@ -210,6 +210,91 @@ class SignalLifetimeSpec: QuickSpec {\n \t\t\t\texpect(signal).to(beNil())\n \t\t\t}\n \t\t}\n+\n+\t\tdescribe(\"observe\") {\n+\t\t\t/// Used to detect the lifetime of `Signal` handlers.\n+\t\t\tfinal class Token {\n+\t\t\t\tprivate let deallocHandler: () -> ()\n+\n+\t\t\t\tinit(deallocHandler: () -> ()) {\n+\t\t\t\t\tself.deallocHandler = deallocHandler\n+\t\t\t\t}\n+\n+\t\t\t\tfunc test() {}\n+\n+\t\t\t\tdeinit { self.deallocHandler() }\n+\t\t\t}\n+\n+\n+\t\t\tvar signal: Signal<Int, TestError>!\n+\t\t\tvar observer: Signal<Int, TestError>.Observer!\n+\n+\t\t\tvar tokenWasDeallocated: Bool!\n+\n+\t\t\tvar token: Token? = nil\n+\t\t\tweak var weakToken: Token?\n+\n+\t\t\tfunc expectTokenNotDeallocated() {\n+\t\t\t\texpect(tokenWasDeallocated) == false\n+\t\t\t\texpect(weakToken).toNot(beNil())","path":"ReactiveCocoaTests/Swift/SignalLifetimeSpec.swift","position":30,"original_position":30,"commit_id":"57e3bc1d7a95b695186d3deda71e00d85f4024fb","original_commit_id":"57e3bc1d7a95b695186d3deda71e00d85f4024fb","user":{"login":"mdiep","id":1302,"avatar_url":"https://avatars.githubusercontent.com/u/1302?v=3","gravatar_id":"","url":"https://api.github.com/users/mdiep","html_url":"https://github.com/mdiep","followers_url":"https://api.github.com/users/mdiep/followers","following_url":"https://api.github.com/users/mdiep/following{/other_user}","gists_url":"https://api.github.com/users/mdiep/gists{/gist_id}","starred_url":"https://api.github.com/users/mdiep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdiep/subscriptions","organizations_url":"https://api.github.com/users/mdiep/orgs","repos_url":"https://api.github.com/users/mdiep/repos","events_url":"https://api.github.com/users/mdiep/events{/privacy}","received_events_url":"https://api.github.com/users/mdiep/received_events","type":"User","site_admin":true},"body":"These two tests seem redundant. Shouldn't it be enough to just test a weak reference? In which case, we could remove `Token` and use an object from Foundation or Swift that supports weak references?","created_at":"2016-02-02T02:45:06Z","updated_at":"2016-02-02T02:45:06Z","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701#discussion_r51515832","pull_request_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701","_links":{"self":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments/51515832"},"html":{"href":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701#discussion_r51515832"},"pull_request":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701"}}},"pull_request":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701","id":57912248,"html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701","diff_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701.diff","patch_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701.patch","issue_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2701","number":2701,"state":"open","locked":false,"title":"Signal lifetime: added test to verify that observe handlers are deallocated","user":{"login":"NachoSoto","id":685609,"avatar_url":"https://avatars.githubusercontent.com/u/685609?v=3","gravatar_id":"","url":"https://api.github.com/users/NachoSoto","html_url":"https://github.com/NachoSoto","followers_url":"https://api.github.com/users/NachoSoto/followers","following_url":"https://api.github.com/users/NachoSoto/following{/other_user}","gists_url":"https://api.github.com/users/NachoSoto/gists{/gist_id}","starred_url":"https://api.github.com/users/NachoSoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NachoSoto/subscriptions","organizations_url":"https://api.github.com/users/NachoSoto/orgs","repos_url":"https://api.github.com/users/NachoSoto/repos","events_url":"https://api.github.com/users/NachoSoto/events{/privacy}","received_events_url":"https://api.github.com/users/NachoSoto/received_events","type":"User","site_admin":false},"body":"Brought up by @CosynPa, I realized that it's a pretty important test to have.\r\nFixes #2698.\r\n\r\nThe test is a bit verbose, but I wanted to make it very exhaustive.","created_at":"2016-02-01T22:41:30Z","updated_at":"2016-02-02T02:45:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a4d3d466c29ae9ea050aa0468b07a9407b0d4fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701/commits","review_comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701/comments","review_comment_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2701/comments","statuses_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/57e3bc1d7a95b695186d3deda71e00d85f4024fb","head":{"label":"NachoSoto:test-signal-handler-lifetime","ref":"test-signal-handler-lifetime","sha":"57e3bc1d7a95b695186d3deda71e00d85f4024fb","user":{"login":"NachoSoto","id":685609,"avatar_url":"https://avatars.githubusercontent.com/u/685609?v=3","gravatar_id":"","url":"https://api.github.com/users/NachoSoto","html_url":"https://github.com/NachoSoto","followers_url":"https://api.github.com/users/NachoSoto/followers","following_url":"https://api.github.com/users/NachoSoto/following{/other_user}","gists_url":"https://api.github.com/users/NachoSoto/gists{/gist_id}","starred_url":"https://api.github.com/users/NachoSoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NachoSoto/subscriptions","organizations_url":"https://api.github.com/users/NachoSoto/orgs","repos_url":"https://api.github.com/users/NachoSoto/repos","events_url":"https://api.github.com/users/NachoSoto/events{/privacy}","received_events_url":"https://api.github.com/users/NachoSoto/received_events","type":"User","site_admin":false},"repo":{"id":30810172,"name":"ReactiveCocoa","full_name":"NachoSoto/ReactiveCocoa","owner":{"login":"NachoSoto","id":685609,"avatar_url":"https://avatars.githubusercontent.com/u/685609?v=3","gravatar_id":"","url":"https://api.github.com/users/NachoSoto","html_url":"https://github.com/NachoSoto","followers_url":"https://api.github.com/users/NachoSoto/followers","following_url":"https://api.github.com/users/NachoSoto/following{/other_user}","gists_url":"https://api.github.com/users/NachoSoto/gists{/gist_id}","starred_url":"https://api.github.com/users/NachoSoto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NachoSoto/subscriptions","organizations_url":"https://api.github.com/users/NachoSoto/orgs","repos_url":"https://api.github.com/users/NachoSoto/repos","events_url":"https://api.github.com/users/NachoSoto/events{/privacy}","received_events_url":"https://api.github.com/users/NachoSoto/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NachoSoto/ReactiveCocoa","description":"A framework for composing and transforming streams of values","fork":true,"url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa","forks_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/forks","keys_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/teams","hooks_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/hooks","issue_events_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/issues/events{/number}","events_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/events","assignees_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/assignees{/user}","branches_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/branches{/branch}","tags_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/tags","blobs_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/languages","stargazers_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/stargazers","contributors_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/contributors","subscribers_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/subscribers","subscription_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/subscription","commits_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/contents/{+path}","compare_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/merges","archive_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/downloads","issues_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/issues{/number}","pulls_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/labels{/name}","releases_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/releases{/id}","deployments_url":"https://api.github.com/repos/NachoSoto/ReactiveCocoa/deployments","created_at":"2015-02-14T22:03:23Z","updated_at":"2015-11-16T15:48:04Z","pushed_at":"2016-02-01T22:41:12Z","git_url":"git://github.com/NachoSoto/ReactiveCocoa.git","ssh_url":"git@github.com:NachoSoto/ReactiveCocoa.git","clone_url":"https://github.com/NachoSoto/ReactiveCocoa.git","svn_url":"https://github.com/NachoSoto/ReactiveCocoa","homepage":"","size":15408,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ReactiveCocoa:master","ref":"master","sha":"def976d4ef5f3e38786a478a673db7c3f9a1d719","user":{"login":"ReactiveCocoa","id":3422977,"avatar_url":"https://avatars.githubusercontent.com/u/3422977?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveCocoa","html_url":"https://github.com/ReactiveCocoa","followers_url":"https://api.github.com/users/ReactiveCocoa/followers","following_url":"https://api.github.com/users/ReactiveCocoa/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveCocoa/subscriptions","organizations_url":"https://api.github.com/users/ReactiveCocoa/orgs","repos_url":"https://api.github.com/users/ReactiveCocoa/repos","events_url":"https://api.github.com/users/ReactiveCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveCocoa/received_events","type":"Organization","site_admin":false},"repo":{"id":3606624,"name":"ReactiveCocoa","full_name":"ReactiveCocoa/ReactiveCocoa","owner":{"login":"ReactiveCocoa","id":3422977,"avatar_url":"https://avatars.githubusercontent.com/u/3422977?v=3","gravatar_id":"","url":"https://api.github.com/users/ReactiveCocoa","html_url":"https://github.com/ReactiveCocoa","followers_url":"https://api.github.com/users/ReactiveCocoa/followers","following_url":"https://api.github.com/users/ReactiveCocoa/following{/other_user}","gists_url":"https://api.github.com/users/ReactiveCocoa/gists{/gist_id}","starred_url":"https://api.github.com/users/ReactiveCocoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ReactiveCocoa/subscriptions","organizations_url":"https://api.github.com/users/ReactiveCocoa/orgs","repos_url":"https://api.github.com/users/ReactiveCocoa/repos","events_url":"https://api.github.com/users/ReactiveCocoa/events{/privacy}","received_events_url":"https://api.github.com/users/ReactiveCocoa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa","description":"Streams of values over time","fork":false,"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa","forks_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/forks","keys_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/teams","hooks_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/hooks","issue_events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/events{/number}","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/events","assignees_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/assignees{/user}","branches_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/branches{/branch}","tags_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/tags","blobs_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/refs{/sha}","trees_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/{sha}","languages_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/languages","stargazers_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/stargazers","contributors_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/contributors","subscribers_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/subscribers","subscription_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/subscription","commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/commits{/sha}","git_commits_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/git/commits{/sha}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/comments{/number}","issue_comment_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/comments{/number}","contents_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/contents/{+path}","compare_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/merges","archive_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/downloads","issues_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues{/number}","pulls_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls{/number}","milestones_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/milestones{/number}","notifications_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/labels{/name}","releases_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/releases{/id}","deployments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/deployments","created_at":"2012-03-02T22:11:24Z","updated_at":"2016-02-02T02:27:09Z","pushed_at":"2016-02-02T02:27:10Z","git_url":"git://github.com/ReactiveCocoa/ReactiveCocoa.git","ssh_url":"git@github.com:ReactiveCocoa/ReactiveCocoa.git","clone_url":"https://github.com/ReactiveCocoa/ReactiveCocoa.git","svn_url":"https://github.com/ReactiveCocoa/ReactiveCocoa","homepage":"","size":23648,"stargazers_count":12474,"watchers_count":12474,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2224,"mirror_url":null,"open_issues_count":238,"forks":2224,"open_issues":238,"watchers":12474,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701"},"html":{"href":"https://github.com/ReactiveCocoa/ReactiveCocoa/pull/2701"},"issue":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2701"},"comments":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/2701/comments"},"review_comments":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701/comments"},"review_comment":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/pulls/2701/commits"},"statuses":{"href":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/statuses/57e3bc1d7a95b695186d3deda71e00d85f4024fb"}}}}