{"action":"created","comment":{"url":"https://api.github.com/repos/education/classroom/pulls/comments/59093971","id":59093971,"diff_hunk":"@@ -1,53 +1,53 @@\n require 'rails_helper'\n \n describe GitHubUser do\n+  it_behaves_like 'a GitHubResource descendant with attributes'\n+\n   before do\n     Octokit.reset!\n-    @client = oauth_client\n   end\n \n-  let(:github_user)       { GitHubUser.new(@client, @client.user.id) }\n-  let(:other_user)        { GitHubFactory.create_classroom_student   }\n-  let(:other_github_user) { GitHubUser.new(@client, other_user.uid)  }\n-\n-  describe '#login', :vcr do\n-    it 'gets the login of the user' do\n-      user = @client.user\n-\n-      expect(github_user.login).to eql(user.login)\n-      expect(WebMock).to have_requested(:get, github_url(\"/user/#{user.id}\"))\n+  context 'with GitHub user', :vcr do\n+    let(:organization) { GitHubFactory.create_owner_classroom_org }\n+    let(:github_user) do\n+      user = organization.users.first\n+      user.github_user\n     end\n \n-    it 'gets the login of another user' do\n-      user = @client.user(other_user.uid)\n-\n-      expect(other_github_user.login).to eql(user.login)\n-      expect(WebMock).to have_requested(:get, github_url(\"/user/#{user.id}\")).twice\n+    let(:other_github_user) do\n+      other_user = GitHubFactory.create_classroom_student\n+      other_user.github_user\n     end\n-  end\n \n-  describe '#organization_memberships', :vcr do\n-    it 'returns an array of organizations that the user belongs to' do\n-      organization_memberships = github_user.organization_memberships\n+    describe '#accept_membership_to' do\n+    end\n \n-      expect(WebMock).to have_requested(:get, github_url('/user/memberships/orgs?state=active'))\n-      expect(organization_memberships).to be_kind_of(Array)\n+    describe '#active_admin?' do\n+      it 'verifies if the user is an admin of the organization' do\n+        expect(github_user.active_admin?(github_organization: organization.github_organization)).to be_truthy\n+      end\n     end\n-  end\n \n-  describe '#user', :vcr do\n-    it 'gets the client users info' do\n-      id = @client.user.id\n+    describe '#client_scopes' do\n+      it 'returns an Array of scopes' do\n+        expect(github_user.client_scopes).to eq(%w(admin:org delete_repo repo user:email))\n+      end\n+    end\n \n-      expect(github_user.user.id).to eql(id)\n-      expect(WebMock).to have_requested(:get, github_url(\"/user/#{id}\"))\n+    describe '#disabled?' do","path":"spec/models/github_user_spec.rb","position":65,"original_position":65,"commit_id":"da62d74d4075ab650039bc781222be533f2ee9c7","original_commit_id":"da62d74d4075ab650039bc781222be533f2ee9c7","user":{"login":"johndbritton","id":123345,"avatar_url":"https://avatars.githubusercontent.com/u/123345?v=3","gravatar_id":"","url":"https://api.github.com/users/johndbritton","html_url":"https://github.com/johndbritton","followers_url":"https://api.github.com/users/johndbritton/followers","following_url":"https://api.github.com/users/johndbritton/following{/other_user}","gists_url":"https://api.github.com/users/johndbritton/gists{/gist_id}","starred_url":"https://api.github.com/users/johndbritton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johndbritton/subscriptions","organizations_url":"https://api.github.com/users/johndbritton/orgs","repos_url":"https://api.github.com/users/johndbritton/repos","events_url":"https://api.github.com/users/johndbritton/events{/privacy}","received_events_url":"https://api.github.com/users/johndbritton/received_events","type":"User","site_admin":true},"body":"Also need to test the opposite case.","created_at":"2016-04-08T21:48:18Z","updated_at":"2016-04-08T21:48:18Z","html_url":"https://github.com/education/classroom/pull/545#discussion_r59093971","pull_request_url":"https://api.github.com/repos/education/classroom/pulls/545","_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/comments/59093971"},"html":{"href":"https://github.com/education/classroom/pull/545#discussion_r59093971"},"pull_request":{"href":"https://api.github.com/repos/education/classroom/pulls/545"}}},"pull_request":{"url":"https://api.github.com/repos/education/classroom/pulls/545","id":65080540,"html_url":"https://github.com/education/classroom/pull/545","diff_url":"https://github.com/education/classroom/pull/545.diff","patch_url":"https://github.com/education/classroom/pull/545.patch","issue_url":"https://api.github.com/repos/education/classroom/issues/545","number":545,"state":"open","locked":false,"title":"[WIP] Kill decorators in Classroom","user":{"login":"tarebyte","id":564113,"avatar_url":"https://avatars.githubusercontent.com/u/564113?v=3","gravatar_id":"","url":"https://api.github.com/users/tarebyte","html_url":"https://github.com/tarebyte","followers_url":"https://api.github.com/users/tarebyte/followers","following_url":"https://api.github.com/users/tarebyte/following{/other_user}","gists_url":"https://api.github.com/users/tarebyte/gists{/gist_id}","starred_url":"https://api.github.com/users/tarebyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarebyte/subscriptions","organizations_url":"https://api.github.com/users/tarebyte/orgs","repos_url":"https://api.github.com/users/tarebyte/repos","events_url":"https://api.github.com/users/tarebyte/events{/privacy}","received_events_url":"https://api.github.com/users/tarebyte/received_events","type":"User","site_admin":true},"body":"This PR removes the draper gem and the decorator pattern in Classroom.\r\n\r\nSome things to note here:\r\n\r\n- [ ] `GitHubResource` objects now use keyword arguments\r\n- [ ] We now pass tokens instead of `GitHubClient` objects\r\n- [ ] If we cannot find a resource with a users key we fallback on the Application client id and secrert. If that fails we fall back on the `NullGitHubResource`\r\n- [ ] GitHubResource attributes are created on the creation of the object.\r\n- [ ] Improved the speed of getting a users token for an organization\r\n- [ ] Test coverage is up to 90% :tada: \r\n\r\n/cc @johndbritton @mkcode for thoughts\r\n\r\n","created_at":"2016-04-03T21:05:21Z","updated_at":"2016-04-08T21:48:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1eccf4cd9bcc69002d435d2da81159181d4bede","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/education/classroom/pulls/545/commits","review_comments_url":"https://api.github.com/repos/education/classroom/pulls/545/comments","review_comment_url":"https://api.github.com/repos/education/classroom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/education/classroom/issues/545/comments","statuses_url":"https://api.github.com/repos/education/classroom/statuses/da62d74d4075ab650039bc781222be533f2ee9c7","head":{"label":"education:kill-decorators","ref":"kill-decorators","sha":"da62d74d4075ab650039bc781222be533f2ee9c7","user":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"repo":{"id":35079964,"name":"classroom","full_name":"education/classroom","owner":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/education/classroom","description":"Classroom for GitHub automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":false,"url":"https://api.github.com/repos/education/classroom","forks_url":"https://api.github.com/repos/education/classroom/forks","keys_url":"https://api.github.com/repos/education/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/education/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/education/classroom/teams","hooks_url":"https://api.github.com/repos/education/classroom/hooks","issue_events_url":"https://api.github.com/repos/education/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/education/classroom/events","assignees_url":"https://api.github.com/repos/education/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/education/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/education/classroom/tags","blobs_url":"https://api.github.com/repos/education/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/education/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/education/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/education/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/education/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/education/classroom/languages","stargazers_url":"https://api.github.com/repos/education/classroom/stargazers","contributors_url":"https://api.github.com/repos/education/classroom/contributors","subscribers_url":"https://api.github.com/repos/education/classroom/subscribers","subscription_url":"https://api.github.com/repos/education/classroom/subscription","commits_url":"https://api.github.com/repos/education/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/education/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/education/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/education/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/education/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/education/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/education/classroom/merges","archive_url":"https://api.github.com/repos/education/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/education/classroom/downloads","issues_url":"https://api.github.com/repos/education/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/education/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/education/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/education/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/education/classroom/labels{/name}","releases_url":"https://api.github.com/repos/education/classroom/releases{/id}","deployments_url":"https://api.github.com/repos/education/classroom/deployments","created_at":"2015-05-05T05:33:50Z","updated_at":"2016-04-08T06:59:27Z","pushed_at":"2016-04-08T15:34:53Z","git_url":"git://github.com/education/classroom.git","ssh_url":"git@github.com:education/classroom.git","clone_url":"https://github.com/education/classroom.git","svn_url":"https://github.com/education/classroom","homepage":"https://classroom.github.com","size":6296,"stargazers_count":363,"watchers_count":363,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":60,"forks":84,"open_issues":60,"watchers":363,"default_branch":"master"}},"base":{"label":"education:master","ref":"master","sha":"df3176d13ca1ffca72cc17d1cf0fe61784f42bd2","user":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"repo":{"id":35079964,"name":"classroom","full_name":"education/classroom","owner":{"login":"education","id":6667880,"avatar_url":"https://avatars.githubusercontent.com/u/6667880?v=3","gravatar_id":"","url":"https://api.github.com/users/education","html_url":"https://github.com/education","followers_url":"https://api.github.com/users/education/followers","following_url":"https://api.github.com/users/education/following{/other_user}","gists_url":"https://api.github.com/users/education/gists{/gist_id}","starred_url":"https://api.github.com/users/education/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/education/subscriptions","organizations_url":"https://api.github.com/users/education/orgs","repos_url":"https://api.github.com/users/education/repos","events_url":"https://api.github.com/users/education/events{/privacy}","received_events_url":"https://api.github.com/users/education/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/education/classroom","description":"Classroom for GitHub automates repository creation and access control, making it easy for teachers to distribute starter code and collect assignments on GitHub.","fork":false,"url":"https://api.github.com/repos/education/classroom","forks_url":"https://api.github.com/repos/education/classroom/forks","keys_url":"https://api.github.com/repos/education/classroom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/education/classroom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/education/classroom/teams","hooks_url":"https://api.github.com/repos/education/classroom/hooks","issue_events_url":"https://api.github.com/repos/education/classroom/issues/events{/number}","events_url":"https://api.github.com/repos/education/classroom/events","assignees_url":"https://api.github.com/repos/education/classroom/assignees{/user}","branches_url":"https://api.github.com/repos/education/classroom/branches{/branch}","tags_url":"https://api.github.com/repos/education/classroom/tags","blobs_url":"https://api.github.com/repos/education/classroom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/education/classroom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/education/classroom/git/refs{/sha}","trees_url":"https://api.github.com/repos/education/classroom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/education/classroom/statuses/{sha}","languages_url":"https://api.github.com/repos/education/classroom/languages","stargazers_url":"https://api.github.com/repos/education/classroom/stargazers","contributors_url":"https://api.github.com/repos/education/classroom/contributors","subscribers_url":"https://api.github.com/repos/education/classroom/subscribers","subscription_url":"https://api.github.com/repos/education/classroom/subscription","commits_url":"https://api.github.com/repos/education/classroom/commits{/sha}","git_commits_url":"https://api.github.com/repos/education/classroom/git/commits{/sha}","comments_url":"https://api.github.com/repos/education/classroom/comments{/number}","issue_comment_url":"https://api.github.com/repos/education/classroom/issues/comments{/number}","contents_url":"https://api.github.com/repos/education/classroom/contents/{+path}","compare_url":"https://api.github.com/repos/education/classroom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/education/classroom/merges","archive_url":"https://api.github.com/repos/education/classroom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/education/classroom/downloads","issues_url":"https://api.github.com/repos/education/classroom/issues{/number}","pulls_url":"https://api.github.com/repos/education/classroom/pulls{/number}","milestones_url":"https://api.github.com/repos/education/classroom/milestones{/number}","notifications_url":"https://api.github.com/repos/education/classroom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/education/classroom/labels{/name}","releases_url":"https://api.github.com/repos/education/classroom/releases{/id}","deployments_url":"https://api.github.com/repos/education/classroom/deployments","created_at":"2015-05-05T05:33:50Z","updated_at":"2016-04-08T06:59:27Z","pushed_at":"2016-04-08T15:34:53Z","git_url":"git://github.com/education/classroom.git","ssh_url":"git@github.com:education/classroom.git","clone_url":"https://github.com/education/classroom.git","svn_url":"https://github.com/education/classroom","homepage":"https://classroom.github.com","size":6296,"stargazers_count":363,"watchers_count":363,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":60,"forks":84,"open_issues":60,"watchers":363,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/education/classroom/pulls/545"},"html":{"href":"https://github.com/education/classroom/pull/545"},"issue":{"href":"https://api.github.com/repos/education/classroom/issues/545"},"comments":{"href":"https://api.github.com/repos/education/classroom/issues/545/comments"},"review_comments":{"href":"https://api.github.com/repos/education/classroom/pulls/545/comments"},"review_comment":{"href":"https://api.github.com/repos/education/classroom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/education/classroom/pulls/545/commits"},"statuses":{"href":"https://api.github.com/repos/education/classroom/statuses/da62d74d4075ab650039bc781222be533f2ee9c7"}}}}