{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/82201032","pull_request_review_id":3121013,"id":82201032,"diff_hunk":"@@ -1,34 +1,87 @@\n describe Account do\n-  before(:each) do\n-    @user = FactoryGirl.create(:account_user)\n-    @group = FactoryGirl.create(:account_group)\n+  let(:user) { FactoryGirl.create(:account_user) }\n+  let(:group) { FactoryGirl.create(:account_group) }\n+\n+  context 'when host has users and groups' do\n+    let(:host) { FactoryGirl.create(:host) }\n+    let(:test_xml) do\n+      REXML::Document.new(\"<miq>\n+                          <accounts>\n+                          <users><user name='test_user'/></users>\n+                          <groups><group name='test_group'/></groups>\n+                          </accounts>\n+                          </miq>\")\n+    end\n+\n+    it '.add_elements' do\n+      user.class.add_elements(host, test_xml)\n+      expect(host.users.find_by(:name => 'test_user')).to be\n+      expect(host.groups.find_by(:name => 'test_group')).to be\n+    end\n   end\n \n   it '#accttype_opposite' do\n-    expect(@user.class.accttype_opposite('user')).to eq('group')\n-    expect(@group.accttype_opposite).to eq('user')\n+    expect(group.accttype_opposite).to eq('user')\n+    expect(user.accttype_opposite).to eq('group')\n   end\n \n-  it '#users raise an error when called on user model' do\n-    expect { @user.users }.to raise_error(RuntimeError, \"Cannot call method 'users' on an Account of type 'user'\")\n+  it 'users raise an error when called on user model' do\n+    expect { user.users }.to raise_error(RuntimeError, \"Cannot call method 'users' on an Account of type 'user'\")\n   end\n \n-  it '#users return empty array when called on group' do\n-    expect(@group.users).to be_empty\n+  it 'users return empty array when called on group' do\n+    expect(group.users).to be_empty\n   end\n \n-  it '#groups raise an error when called on group model' do\n-    expect { @group.groups }.to raise_error(RuntimeError, \"Cannot call method 'groups' on an Account of type 'group'\")\n+  it 'groups raise an error when called on group model' do\n+    expect { group.groups }.to raise_error(RuntimeError, \"Cannot call method 'groups' on an Account of type 'group'\")\n   end\n \n-  it '#groups returns empty array when called on user model' do\n-    expect(@user.groups).to be_empty\n+  it 'groups returns empty array when called on user model' do\n+    expect(user.groups).to be_empty\n+  end\n+\n+  describe 'group methods' do\n+    let(:user1) { FactoryGirl.create(:account_user) }","path":"spec/models/account_spec.rb","position":58,"original_position":58,"commit_id":"1bd771cea743a19912310a78161ac48398c1ad58","original_commit_id":"1bd771cea743a19912310a78161ac48398c1ad58","user":{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars.githubusercontent.com/u/2430490?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false},"body":"While we often say the first element is the 0th, the differentiation between `user` and `user1` is a bit odd. How about `user_account` and `user_account2`?","created_at":"2016-10-06T14:27:48Z","updated_at":"2016-10-06T14:27:48Z","html_url":"https://github.com/ManageIQ/manageiq/pull/11734#discussion_r82201032","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/82201032"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/11734#discussion_r82201032"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734","id":88216689,"html_url":"https://github.com/ManageIQ/manageiq/pull/11734","diff_url":"https://github.com/ManageIQ/manageiq/pull/11734.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/11734.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11734","number":11734,"state":"open","locked":false,"title":"spec: add test coverage for the account model","user":{"login":"cynepco3hahue","id":4704810,"avatar_url":"https://avatars.githubusercontent.com/u/4704810?v=3","gravatar_id":"","url":"https://api.github.com/users/cynepco3hahue","html_url":"https://github.com/cynepco3hahue","followers_url":"https://api.github.com/users/cynepco3hahue/followers","following_url":"https://api.github.com/users/cynepco3hahue/following{/other_user}","gists_url":"https://api.github.com/users/cynepco3hahue/gists{/gist_id}","starred_url":"https://api.github.com/users/cynepco3hahue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cynepco3hahue/subscriptions","organizations_url":"https://api.github.com/users/cynepco3hahue/orgs","repos_url":"https://api.github.com/users/cynepco3hahue/repos","events_url":"https://api.github.com/users/cynepco3hahue/events{/privacy}","received_events_url":"https://api.github.com/users/cynepco3hahue/received_events","type":"User","site_admin":false},"body":"- Add test coverage for the app/models/account.rb\r\n\r\n","created_at":"2016-10-06T08:18:18Z","updated_at":"2016-10-06T14:58:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c8292037233aad429fdb067721cb6bb3fe74043","assignee":{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars.githubusercontent.com/u/2430490?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false},"assignees":[{"login":"chrisarcand","id":2430490,"avatar_url":"https://avatars.githubusercontent.com/u/2430490?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisarcand","html_url":"https://github.com/chrisarcand","followers_url":"https://api.github.com/users/chrisarcand/followers","following_url":"https://api.github.com/users/chrisarcand/following{/other_user}","gists_url":"https://api.github.com/users/chrisarcand/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisarcand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisarcand/subscriptions","organizations_url":"https://api.github.com/users/chrisarcand/orgs","repos_url":"https://api.github.com/users/chrisarcand/repos","events_url":"https://api.github.com/users/chrisarcand/events{/privacy}","received_events_url":"https://api.github.com/users/chrisarcand/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/11734/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/1bd771cea743a19912310a78161ac48398c1ad58","head":{"label":"cynepco3hahue:add_test_coverage_models_account","ref":"add_test_coverage_models_account","sha":"1bd771cea743a19912310a78161ac48398c1ad58","user":{"login":"cynepco3hahue","id":4704810,"avatar_url":"https://avatars.githubusercontent.com/u/4704810?v=3","gravatar_id":"","url":"https://api.github.com/users/cynepco3hahue","html_url":"https://github.com/cynepco3hahue","followers_url":"https://api.github.com/users/cynepco3hahue/followers","following_url":"https://api.github.com/users/cynepco3hahue/following{/other_user}","gists_url":"https://api.github.com/users/cynepco3hahue/gists{/gist_id}","starred_url":"https://api.github.com/users/cynepco3hahue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cynepco3hahue/subscriptions","organizations_url":"https://api.github.com/users/cynepco3hahue/orgs","repos_url":"https://api.github.com/users/cynepco3hahue/repos","events_url":"https://api.github.com/users/cynepco3hahue/events{/privacy}","received_events_url":"https://api.github.com/users/cynepco3hahue/received_events","type":"User","site_admin":false},"repo":{"id":61523946,"name":"manageiq","full_name":"cynepco3hahue/manageiq","owner":{"login":"cynepco3hahue","id":4704810,"avatar_url":"https://avatars.githubusercontent.com/u/4704810?v=3","gravatar_id":"","url":"https://api.github.com/users/cynepco3hahue","html_url":"https://github.com/cynepco3hahue","followers_url":"https://api.github.com/users/cynepco3hahue/followers","following_url":"https://api.github.com/users/cynepco3hahue/following{/other_user}","gists_url":"https://api.github.com/users/cynepco3hahue/gists{/gist_id}","starred_url":"https://api.github.com/users/cynepco3hahue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cynepco3hahue/subscriptions","organizations_url":"https://api.github.com/users/cynepco3hahue/orgs","repos_url":"https://api.github.com/users/cynepco3hahue/repos","events_url":"https://api.github.com/users/cynepco3hahue/events{/privacy}","received_events_url":"https://api.github.com/users/cynepco3hahue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cynepco3hahue/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/cynepco3hahue/manageiq","forks_url":"https://api.github.com/repos/cynepco3hahue/manageiq/forks","keys_url":"https://api.github.com/repos/cynepco3hahue/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cynepco3hahue/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cynepco3hahue/manageiq/teams","hooks_url":"https://api.github.com/repos/cynepco3hahue/manageiq/hooks","issue_events_url":"https://api.github.com/repos/cynepco3hahue/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/cynepco3hahue/manageiq/events","assignees_url":"https://api.github.com/repos/cynepco3hahue/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/cynepco3hahue/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/cynepco3hahue/manageiq/tags","blobs_url":"https://api.github.com/repos/cynepco3hahue/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cynepco3hahue/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cynepco3hahue/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/cynepco3hahue/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cynepco3hahue/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/cynepco3hahue/manageiq/languages","stargazers_url":"https://api.github.com/repos/cynepco3hahue/manageiq/stargazers","contributors_url":"https://api.github.com/repos/cynepco3hahue/manageiq/contributors","subscribers_url":"https://api.github.com/repos/cynepco3hahue/manageiq/subscribers","subscription_url":"https://api.github.com/repos/cynepco3hahue/manageiq/subscription","commits_url":"https://api.github.com/repos/cynepco3hahue/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/cynepco3hahue/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/cynepco3hahue/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/cynepco3hahue/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/cynepco3hahue/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/cynepco3hahue/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cynepco3hahue/manageiq/merges","archive_url":"https://api.github.com/repos/cynepco3hahue/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cynepco3hahue/manageiq/downloads","issues_url":"https://api.github.com/repos/cynepco3hahue/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/cynepco3hahue/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/cynepco3hahue/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/cynepco3hahue/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cynepco3hahue/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/cynepco3hahue/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/cynepco3hahue/manageiq/deployments","created_at":"2016-06-20T06:59:49Z","updated_at":"2016-06-20T07:00:10Z","pushed_at":"2016-10-06T14:58:57Z","git_url":"git://github.com/cynepco3hahue/manageiq.git","ssh_url":"git@github.com:cynepco3hahue/manageiq.git","clone_url":"https://github.com/cynepco3hahue/manageiq.git","svn_url":"https://github.com/cynepco3hahue/manageiq","homepage":"manageiq.org","size":161045,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"d9bfb5e4c02b63a3db29b4dd082b8ab244e160c6","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":20789757,"name":"manageiq","full_name":"ManageIQ/manageiq","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/manageiq","description":"ManageIQ Open-Source Management Platform","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq","forks_url":"https://api.github.com/repos/ManageIQ/manageiq/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq/deployments","created_at":"2014-06-13T02:31:26Z","updated_at":"2016-10-05T13:39:00Z","pushed_at":"2016-10-06T14:58:56Z","git_url":"git://github.com/ManageIQ/manageiq.git","ssh_url":"git@github.com:ManageIQ/manageiq.git","clone_url":"https://github.com/ManageIQ/manageiq.git","svn_url":"https://github.com/ManageIQ/manageiq","homepage":"manageiq.org","size":208639,"stargazers_count":333,"watchers_count":333,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":359,"mirror_url":null,"open_issues_count":830,"forks":359,"open_issues":830,"watchers":333,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/11734"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/11734"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/11734/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/11734/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/1bd771cea743a19912310a78161ac48398c1ad58"}}}}
{"actor":{"display_login":"chrisarcand"}}