{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/52936665","id":52936665,"diff_hunk":"@@ -1,14 +1,62 @@\n describe MiqReportResult do\n-  context \"persisting generated report results\" do\n-    before(:each) do\n-      EvmSpecHelper.local_miq_server\n+  before :each do\n+    EvmSpecHelper.local_miq_server\n+\n+    @user1 = FactoryGirl.create(:user_with_group)\n+  end\n+\n+  context \"report result created by User 1 with current group 1\" do\n+    before :each do\n+      @report_1 = FactoryGirl.create(:miq_report)\n+      group_1 = FactoryGirl.create(:miq_group)\n+      group_2 = FactoryGirl.create(:miq_group)\n+      @user1.miq_groups << group_1\n+      @report_result1 = FactoryGirl.create(:miq_report_result, :miq_report_id => @report_1.id, :miq_group => group_1)\n+      @report_result2 = FactoryGirl.create(:miq_report_result, :miq_report_id => @report_1.id, :miq_group => group_1)\n+      @report_result_nil_report_id = FactoryGirl.create(:miq_report_result)\n+\n+      @report_2 = FactoryGirl.create(:miq_report)\n+      @report_result3 = FactoryGirl.create(:miq_report_result, :miq_report_id => @report_2.id, :miq_group => group_2)\n+      User.current_user = @user1\n+    end\n+\n+    describe \".with_report\" do\n+      it \"returns report all results without nil report_id\" do\n+        report_result = MiqReportResult.with_report\n+        expect(report_result).to match_array([@report_result1, @report_result2, @report_result3])\n+        expect(report_result).not_to include(@report_result_nil_report_id)\n+      end\n+\n+      it \"returns only requested report results\" do\n+        report_result = MiqReportResult.with_report(@report_result1.miq_report_id)\n+        expect(report_result).to match_array([@report_result1, @report_result2])\n+        expect(report_result).not_to match_array([@report_result3, @report_result_nil_report_id])\n+      end\n+    end\n \n-      @user = FactoryGirl.create(:user_with_group)\n+    describe \".with_current_user_groups\" do\n+      it \"returns report results by generated by user 1, non-admin user logged\" do","path":"spec/models/miq_report_result_spec.rb","position":42,"original_position":42,"commit_id":"75459d9da2218b6baa54dd83c71a8b8ba7f40cbe","original_commit_id":"75459d9da2218b6baa54dd83c71a8b8ba7f40cbe","user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"body":"or maybe `returns report results generated core the current a non-admin user`","created_at":"2016-02-15T19:38:46Z","updated_at":"2016-02-15T19:38:46Z","html_url":"https://github.com/ManageIQ/manageiq/pull/6316#discussion_r52936665","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments/52936665"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/6316#discussion_r52936665"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316","id":57013919,"html_url":"https://github.com/ManageIQ/manageiq/pull/6316","diff_url":"https://github.com/ManageIQ/manageiq/pull/6316.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/6316.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6316","number":6316,"state":"open","locked":false,"title":"Convert set_saved_reports_condition to relation","user":{"login":"lpichler","id":14937244,"avatar_url":"https://avatars.githubusercontent.com/u/14937244?v=3","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"body":"https://github.com/ManageIQ/manageiq/pull/5628#discussion_r46155640 (issue: https://github.com/ManageIQ/manageiq/issues/5708)\r\n\r\nRemoving set_saved_reports_condition from controllers and moving it\r\nto the `MiqReportResult` model and separated to 3 methods.\r\nReplacing `set_saved_reports_condition` calls for\r\n`with_current_user_groups_and_report` and passing into RBAC's\r\nthru named_scope parameter as relation.\r\n\r\ncc @jrafanie ","created_at":"2016-01-24T21:11:53Z","updated_at":"2016-02-15T19:38:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"118f928b6edcfe7f30514f4d85d50eefccb6ac86","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/6316/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq/statuses/75459d9da2218b6baa54dd83c71a8b8ba7f40cbe","head":{"label":"lpichler:refactor_saved_reports_condition","ref":"refactor_saved_reports_condition","sha":"75459d9da2218b6baa54dd83c71a8b8ba7f40cbe","user":{"login":"lpichler","id":14937244,"avatar_url":"https://avatars.githubusercontent.com/u/14937244?v=3","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"repo":{"id":43540953,"name":"manageiq","full_name":"lpichler/manageiq","owner":{"login":"lpichler","id":14937244,"avatar_url":"https://avatars.githubusercontent.com/u/14937244?v=3","gravatar_id":"","url":"https://api.github.com/users/lpichler","html_url":"https://github.com/lpichler","followers_url":"https://api.github.com/users/lpichler/followers","following_url":"https://api.github.com/users/lpichler/following{/other_user}","gists_url":"https://api.github.com/users/lpichler/gists{/gist_id}","starred_url":"https://api.github.com/users/lpichler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lpichler/subscriptions","organizations_url":"https://api.github.com/users/lpichler/orgs","repos_url":"https://api.github.com/users/lpichler/repos","events_url":"https://api.github.com/users/lpichler/events{/privacy}","received_events_url":"https://api.github.com/users/lpichler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lpichler/manageiq","description":"ManageIQ Cloud Management Platform","fork":true,"url":"https://api.github.com/repos/lpichler/manageiq","forks_url":"https://api.github.com/repos/lpichler/manageiq/forks","keys_url":"https://api.github.com/repos/lpichler/manageiq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lpichler/manageiq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lpichler/manageiq/teams","hooks_url":"https://api.github.com/repos/lpichler/manageiq/hooks","issue_events_url":"https://api.github.com/repos/lpichler/manageiq/issues/events{/number}","events_url":"https://api.github.com/repos/lpichler/manageiq/events","assignees_url":"https://api.github.com/repos/lpichler/manageiq/assignees{/user}","branches_url":"https://api.github.com/repos/lpichler/manageiq/branches{/branch}","tags_url":"https://api.github.com/repos/lpichler/manageiq/tags","blobs_url":"https://api.github.com/repos/lpichler/manageiq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lpichler/manageiq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lpichler/manageiq/git/refs{/sha}","trees_url":"https://api.github.com/repos/lpichler/manageiq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lpichler/manageiq/statuses/{sha}","languages_url":"https://api.github.com/repos/lpichler/manageiq/languages","stargazers_url":"https://api.github.com/repos/lpichler/manageiq/stargazers","contributors_url":"https://api.github.com/repos/lpichler/manageiq/contributors","subscribers_url":"https://api.github.com/repos/lpichler/manageiq/subscribers","subscription_url":"https://api.github.com/repos/lpichler/manageiq/subscription","commits_url":"https://api.github.com/repos/lpichler/manageiq/commits{/sha}","git_commits_url":"https://api.github.com/repos/lpichler/manageiq/git/commits{/sha}","comments_url":"https://api.github.com/repos/lpichler/manageiq/comments{/number}","issue_comment_url":"https://api.github.com/repos/lpichler/manageiq/issues/comments{/number}","contents_url":"https://api.github.com/repos/lpichler/manageiq/contents/{+path}","compare_url":"https://api.github.com/repos/lpichler/manageiq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lpichler/manageiq/merges","archive_url":"https://api.github.com/repos/lpichler/manageiq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lpichler/manageiq/downloads","issues_url":"https://api.github.com/repos/lpichler/manageiq/issues{/number}","pulls_url":"https://api.github.com/repos/lpichler/manageiq/pulls{/number}","milestones_url":"https://api.github.com/repos/lpichler/manageiq/milestones{/number}","notifications_url":"https://api.github.com/repos/lpichler/manageiq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lpichler/manageiq/labels{/name}","releases_url":"https://api.github.com/repos/lpichler/manageiq/releases{/id}","deployments_url":"https://api.github.com/repos/lpichler/manageiq/deployments","created_at":"2015-10-02T07:37:28Z","updated_at":"2016-01-11T09:22:37Z","pushed_at":"2016-02-15T18:30:41Z","git_url":"git://github.com/lpichler/manageiq.git","ssh_url":"git@github.com:lpichler/manageiq.git","clone_url":"https://github.com/lpichler/manageiq.git","svn_url":"https://github.com/lpichler/manageiq","homepage":"manageiq.org","size":105233,"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":"a6a042c1c9c34784914ec98e8aca9a34f5843184","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 Cloud 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-02-15T15:43:52Z","pushed_at":"2016-02-15T19:32:54Z","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":141327,"stargazers_count":216,"watchers_count":216,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":230,"mirror_url":null,"open_issues_count":524,"forks":230,"open_issues":524,"watchers":216,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316"},"html":{"href":"https://github.com/ManageIQ/manageiq/pull/6316"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/6316"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/issues/6316/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq/pulls/6316/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq/statuses/75459d9da2218b6baa54dd83c71a8b8ba7f40cbe"}}}}