{"action":"created","comment":{"url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments/37305148","id":37305148,"diff_hunk":"@@ -145,6 +145,45 @@\n     end\n   end\n \n+  describe '#retire_subject' do\n+    it 'marks a counted subject as retired' do\n+      workflow = create(:workflow_with_subject_sets)\n+      subject = create(:subject, subject_sets: workflow.subject_sets)\n+      count = create(:subject_workflow_count, set_member_subject: subject.set_member_subjects.first, workflow: workflow)\n+\n+      workflow.retire_subject(subject.id)\n+      expect(subject.retired_for_workflow?(workflow)).to be_truthy\n+      expect(SubjectWorkflowCount.retired.count).to eq(2)\n+    end\n+\n+    it 'marks an uncounted subject as retired' do\n+      workflow = create(:workflow_with_subject_sets)\n+      subject = create(:subject, subject_sets: workflow.subject_sets)\n+\n+      workflow.retire_subject(subject.id)\n+      expect(subject.retired_for_workflow?(workflow)).to be_truthy\n+      expect(SubjectWorkflowCount.retired.count).to eq(2)\n+    end\n+\n+    it 'leaves a retired subject retired' do\n+      workflow = create(:workflow_with_subject_sets)\n+      subject = create(:subject, subject_sets: workflow.subject_sets)\n+\n+      workflow.retire_subject(subject.id)\n+      workflow.retire_subject(subject.id)","path":"spec/models/workflow_spec.rb","position":29,"original_position":29,"commit_id":"aff52123f93718ab428afb21be0d9b1d691c5eaa","original_commit_id":"aff52123f93718ab428afb21be0d9b1d691c5eaa","user":{"login":"marten","id":277,"avatar_url":"https://avatars.githubusercontent.com/u/277?v=3","gravatar_id":"","url":"https://api.github.com/users/marten","html_url":"https://github.com/marten","followers_url":"https://api.github.com/users/marten/followers","following_url":"https://api.github.com/users/marten/following{/other_user}","gists_url":"https://api.github.com/users/marten/gists{/gist_id}","starred_url":"https://api.github.com/users/marten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marten/subscriptions","organizations_url":"https://api.github.com/users/marten/orgs","repos_url":"https://api.github.com/users/marten/repos","events_url":"https://api.github.com/users/marten/events{/privacy}","received_events_url":"https://api.github.com/users/marten/received_events","type":"User","site_admin":false},"body":"No, `#retire!` has a guard that early-returns when it's already retired.","created_at":"2015-08-18T14:34:32Z","updated_at":"2015-08-18T14:34:32Z","html_url":"https://github.com/zooniverse/Panoptes/pull/1277#discussion_r37305148","pull_request_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277","_links":{"self":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments/37305148"},"html":{"href":"https://github.com/zooniverse/Panoptes/pull/1277#discussion_r37305148"},"pull_request":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277"}}},"pull_request":{"url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277","id":42592011,"html_url":"https://github.com/zooniverse/Panoptes/pull/1277","diff_url":"https://github.com/zooniverse/Panoptes/pull/1277.diff","patch_url":"https://github.com/zooniverse/Panoptes/pull/1277.patch","issue_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/1277","number":1277,"state":"open","locked":false,"title":"Make retiring subject possible via update_links on a workflow","user":{"login":"marten","id":277,"avatar_url":"https://avatars.githubusercontent.com/u/277?v=3","gravatar_id":"","url":"https://api.github.com/users/marten","html_url":"https://github.com/marten","followers_url":"https://api.github.com/users/marten/followers","following_url":"https://api.github.com/users/marten/following{/other_user}","gists_url":"https://api.github.com/users/marten/gists{/gist_id}","starred_url":"https://api.github.com/users/marten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marten/subscriptions","organizations_url":"https://api.github.com/users/marten/orgs","repos_url":"https://api.github.com/users/marten/repos","events_url":"https://api.github.com/users/marten/events{/privacy}","received_events_url":"https://api.github.com/users/marten/received_events","type":"User","site_admin":false},"body":"Fixes #1098","created_at":"2015-08-17T14:12:18Z","updated_at":"2015-08-18T14:34:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"00832676ee064d0c2bf5edf795770f51b1e91b2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277/commits","review_comments_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277/comments","review_comment_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/1277/comments","statuses_url":"https://api.github.com/repos/zooniverse/Panoptes/statuses/aff52123f93718ab428afb21be0d9b1d691c5eaa","head":{"label":"marten:retire-via-api-2","ref":"retire-via-api-2","sha":"aff52123f93718ab428afb21be0d9b1d691c5eaa","user":{"login":"marten","id":277,"avatar_url":"https://avatars.githubusercontent.com/u/277?v=3","gravatar_id":"","url":"https://api.github.com/users/marten","html_url":"https://github.com/marten","followers_url":"https://api.github.com/users/marten/followers","following_url":"https://api.github.com/users/marten/following{/other_user}","gists_url":"https://api.github.com/users/marten/gists{/gist_id}","starred_url":"https://api.github.com/users/marten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marten/subscriptions","organizations_url":"https://api.github.com/users/marten/orgs","repos_url":"https://api.github.com/users/marten/repos","events_url":"https://api.github.com/users/marten/events{/privacy}","received_events_url":"https://api.github.com/users/marten/received_events","type":"User","site_admin":false},"repo":{"id":37596587,"name":"Panoptes","full_name":"marten/Panoptes","owner":{"login":"marten","id":277,"avatar_url":"https://avatars.githubusercontent.com/u/277?v=3","gravatar_id":"","url":"https://api.github.com/users/marten","html_url":"https://github.com/marten","followers_url":"https://api.github.com/users/marten/followers","following_url":"https://api.github.com/users/marten/following{/other_user}","gists_url":"https://api.github.com/users/marten/gists{/gist_id}","starred_url":"https://api.github.com/users/marten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marten/subscriptions","organizations_url":"https://api.github.com/users/marten/orgs","repos_url":"https://api.github.com/users/marten/repos","events_url":"https://api.github.com/users/marten/events{/privacy}","received_events_url":"https://api.github.com/users/marten/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marten/Panoptes","description":"It sees everything","fork":true,"url":"https://api.github.com/repos/marten/Panoptes","forks_url":"https://api.github.com/repos/marten/Panoptes/forks","keys_url":"https://api.github.com/repos/marten/Panoptes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marten/Panoptes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marten/Panoptes/teams","hooks_url":"https://api.github.com/repos/marten/Panoptes/hooks","issue_events_url":"https://api.github.com/repos/marten/Panoptes/issues/events{/number}","events_url":"https://api.github.com/repos/marten/Panoptes/events","assignees_url":"https://api.github.com/repos/marten/Panoptes/assignees{/user}","branches_url":"https://api.github.com/repos/marten/Panoptes/branches{/branch}","tags_url":"https://api.github.com/repos/marten/Panoptes/tags","blobs_url":"https://api.github.com/repos/marten/Panoptes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marten/Panoptes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marten/Panoptes/git/refs{/sha}","trees_url":"https://api.github.com/repos/marten/Panoptes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marten/Panoptes/statuses/{sha}","languages_url":"https://api.github.com/repos/marten/Panoptes/languages","stargazers_url":"https://api.github.com/repos/marten/Panoptes/stargazers","contributors_url":"https://api.github.com/repos/marten/Panoptes/contributors","subscribers_url":"https://api.github.com/repos/marten/Panoptes/subscribers","subscription_url":"https://api.github.com/repos/marten/Panoptes/subscription","commits_url":"https://api.github.com/repos/marten/Panoptes/commits{/sha}","git_commits_url":"https://api.github.com/repos/marten/Panoptes/git/commits{/sha}","comments_url":"https://api.github.com/repos/marten/Panoptes/comments{/number}","issue_comment_url":"https://api.github.com/repos/marten/Panoptes/issues/comments{/number}","contents_url":"https://api.github.com/repos/marten/Panoptes/contents/{+path}","compare_url":"https://api.github.com/repos/marten/Panoptes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marten/Panoptes/merges","archive_url":"https://api.github.com/repos/marten/Panoptes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marten/Panoptes/downloads","issues_url":"https://api.github.com/repos/marten/Panoptes/issues{/number}","pulls_url":"https://api.github.com/repos/marten/Panoptes/pulls{/number}","milestones_url":"https://api.github.com/repos/marten/Panoptes/milestones{/number}","notifications_url":"https://api.github.com/repos/marten/Panoptes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marten/Panoptes/labels{/name}","releases_url":"https://api.github.com/repos/marten/Panoptes/releases{/id}","created_at":"2015-06-17T13:29:32Z","updated_at":"2015-06-17T13:29:33Z","pushed_at":"2015-08-18T11:14:41Z","git_url":"git://github.com/marten/Panoptes.git","ssh_url":"git@github.com:marten/Panoptes.git","clone_url":"https://github.com/marten/Panoptes.git","svn_url":"https://github.com/marten/Panoptes","homepage":"","size":4273,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"zooniverse:master","ref":"master","sha":"1537ecfeb929267e5f4236169f4cf2cf92986bfd","user":{"login":"zooniverse","id":106856,"avatar_url":"https://avatars.githubusercontent.com/u/106856?v=3","gravatar_id":"","url":"https://api.github.com/users/zooniverse","html_url":"https://github.com/zooniverse","followers_url":"https://api.github.com/users/zooniverse/followers","following_url":"https://api.github.com/users/zooniverse/following{/other_user}","gists_url":"https://api.github.com/users/zooniverse/gists{/gist_id}","starred_url":"https://api.github.com/users/zooniverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooniverse/subscriptions","organizations_url":"https://api.github.com/users/zooniverse/orgs","repos_url":"https://api.github.com/users/zooniverse/repos","events_url":"https://api.github.com/users/zooniverse/events{/privacy}","received_events_url":"https://api.github.com/users/zooniverse/received_events","type":"Organization","site_admin":false},"repo":{"id":19036577,"name":"Panoptes","full_name":"zooniverse/Panoptes","owner":{"login":"zooniverse","id":106856,"avatar_url":"https://avatars.githubusercontent.com/u/106856?v=3","gravatar_id":"","url":"https://api.github.com/users/zooniverse","html_url":"https://github.com/zooniverse","followers_url":"https://api.github.com/users/zooniverse/followers","following_url":"https://api.github.com/users/zooniverse/following{/other_user}","gists_url":"https://api.github.com/users/zooniverse/gists{/gist_id}","starred_url":"https://api.github.com/users/zooniverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zooniverse/subscriptions","organizations_url":"https://api.github.com/users/zooniverse/orgs","repos_url":"https://api.github.com/users/zooniverse/repos","events_url":"https://api.github.com/users/zooniverse/events{/privacy}","received_events_url":"https://api.github.com/users/zooniverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zooniverse/Panoptes","description":"It sees everything","fork":false,"url":"https://api.github.com/repos/zooniverse/Panoptes","forks_url":"https://api.github.com/repos/zooniverse/Panoptes/forks","keys_url":"https://api.github.com/repos/zooniverse/Panoptes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zooniverse/Panoptes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zooniverse/Panoptes/teams","hooks_url":"https://api.github.com/repos/zooniverse/Panoptes/hooks","issue_events_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/events{/number}","events_url":"https://api.github.com/repos/zooniverse/Panoptes/events","assignees_url":"https://api.github.com/repos/zooniverse/Panoptes/assignees{/user}","branches_url":"https://api.github.com/repos/zooniverse/Panoptes/branches{/branch}","tags_url":"https://api.github.com/repos/zooniverse/Panoptes/tags","blobs_url":"https://api.github.com/repos/zooniverse/Panoptes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zooniverse/Panoptes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zooniverse/Panoptes/git/refs{/sha}","trees_url":"https://api.github.com/repos/zooniverse/Panoptes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zooniverse/Panoptes/statuses/{sha}","languages_url":"https://api.github.com/repos/zooniverse/Panoptes/languages","stargazers_url":"https://api.github.com/repos/zooniverse/Panoptes/stargazers","contributors_url":"https://api.github.com/repos/zooniverse/Panoptes/contributors","subscribers_url":"https://api.github.com/repos/zooniverse/Panoptes/subscribers","subscription_url":"https://api.github.com/repos/zooniverse/Panoptes/subscription","commits_url":"https://api.github.com/repos/zooniverse/Panoptes/commits{/sha}","git_commits_url":"https://api.github.com/repos/zooniverse/Panoptes/git/commits{/sha}","comments_url":"https://api.github.com/repos/zooniverse/Panoptes/comments{/number}","issue_comment_url":"https://api.github.com/repos/zooniverse/Panoptes/issues/comments{/number}","contents_url":"https://api.github.com/repos/zooniverse/Panoptes/contents/{+path}","compare_url":"https://api.github.com/repos/zooniverse/Panoptes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zooniverse/Panoptes/merges","archive_url":"https://api.github.com/repos/zooniverse/Panoptes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zooniverse/Panoptes/downloads","issues_url":"https://api.github.com/repos/zooniverse/Panoptes/issues{/number}","pulls_url":"https://api.github.com/repos/zooniverse/Panoptes/pulls{/number}","milestones_url":"https://api.github.com/repos/zooniverse/Panoptes/milestones{/number}","notifications_url":"https://api.github.com/repos/zooniverse/Panoptes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zooniverse/Panoptes/labels{/name}","releases_url":"https://api.github.com/repos/zooniverse/Panoptes/releases{/id}","created_at":"2014-04-22T16:16:02Z","updated_at":"2015-08-07T23:14:02Z","pushed_at":"2015-08-18T14:25:42Z","git_url":"git://github.com/zooniverse/Panoptes.git","ssh_url":"git@github.com:zooniverse/Panoptes.git","clone_url":"https://github.com/zooniverse/Panoptes.git","svn_url":"https://github.com/zooniverse/Panoptes","homepage":"","size":8403,"stargazers_count":30,"watchers_count":30,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":63,"forks":13,"open_issues":63,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277"},"html":{"href":"https://github.com/zooniverse/Panoptes/pull/1277"},"issue":{"href":"https://api.github.com/repos/zooniverse/Panoptes/issues/1277"},"comments":{"href":"https://api.github.com/repos/zooniverse/Panoptes/issues/1277/comments"},"review_comments":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277/comments"},"review_comment":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zooniverse/Panoptes/pulls/1277/commits"},"statuses":{"href":"https://api.github.com/repos/zooniverse/Panoptes/statuses/aff52123f93718ab428afb21be0d9b1d691c5eaa"}}}}