{"action":"created","comment":{"url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/comments/38277848","id":38277848,"diff_hunk":"@@ -206,176 +45,79 @@\n   context \"as a guest user\" do\n     let(:user) { Fabricate(:user) }\n \n-    context \"visiting the home page\" do\n-      let(:controller) { \"homepage\" }\n-\n-      context \"looking at homepage#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n+    { \"homepage#index\" => true,\n+      \"projects#index\" => true,\n+      \"projects#show\" => true,\n+      \"companies#index\" => true,\n+      \"companies#show\" => true,\n+      \"companies/projects#index\" => true,\n+      \"companies/projects#show\" => true,\n+      \"companies/projects#create\" => nil,\n+      \"companies/projects#edit\" => nil,\n+      \"companies/projects#update\" => nil,\n+      \"companies/projects#destroy\" => nil,\n+      \"sessions#new\" => true,\n+      \"sessions#create\" => true,\n+      \"sessions#destroy\" => nil,\n+      \"users#show\" => nil,\n+      \"users#update\" => nil,\n+      \"cart_items#index\" => true,\n+      \"cart_items#create\" => true,\n+      \"cart_items#update\" => true,\n+      \"cart_items#destroy\" => true,\n+      \"orders#index\" => nil,\n+      \"orders#show\" => nil,\n+      \"orders#create\" => nil,\n+      \"users#create\" => true }.each do |pair, result|\n+\n+      context \"looking at #{pair}\" do\n+        let(:controller) { pair.split('#').first }\n+        let(:action) { pair.split('#').last }\n+\n+        it \"#{result ? 'allows' : 'denies'} access\" do\n+          expect(allowed).to be(result)\n         end\n       end\n     end\n+  end\n \n-    context \"visiting companies\" do\n-      let(:controller) { \"companies\" }\n-\n-      context \"looking at companies#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at companies#show\" do\n-        let(:action) { \"show\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"visiting projects\" do\n-      let(:controller) { \"projects\" }\n-\n-      context \"looking at projects#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at projects#show\" do\n-        let(:action) { \"show\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"visiting companies/projects\" do\n-      let(:controller) { \"companies/projects\" }\n-\n-      context \"looking at companies/projects#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at companies/projects#show\" do\n-        let(:action) { \"show\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"logging in\" do\n-      let(:controller) { \"sessions\" }\n-\n-      context \"looking at sessions#new\" do\n-        let(:action) { \"new\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at sessions#create\" do\n-        let(:action) { \"create\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"signing up for an account\" do\n-      let(:controller) { \"users\" }\n-\n-      context \"looking at users#create\" do\n-        let(:action) { \"create\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"adding, removing, and updating items in the cart\" do\n-      let(:controller) { \"cart_items\" }\n-\n-      context \"looking at cart_items#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at cart_items#create\" do\n-        let(:action) { \"create\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at cart_items#update\" do\n-        let(:action) { \"update\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-\n-      context \"looking at cart_items#destroy\" do\n-        let(:action) { \"destroy\" }\n-\n-        it \"allows access\" do\n-          expect(allowed).to be true\n-        end\n-      end\n-    end\n-\n-    context \"visiting orders\" do\n-      let(:controller) { \"orders\" }\n-\n-      context \"looking at orders#index\" do\n-        let(:action) { \"index\" }\n-\n-        it \"denies access\" do\n-          expect(allowed).to be nil\n-        end\n-      end\n-\n-      context \"looking at orders#create\" do\n-        let(:action) { \"create\" }\n-\n-        it \"denies access\" do\n-          expect(allowed).to be nil\n-        end\n-      end\n-\n-      context \"looking at orders#show\" do\n-        let(:action) { \"show\" }\n-\n-        it \"denies access\" do\n-          expect(allowed).to be nil\n+  context \"as a company admin\" do\n+    let(:user) { Fabricate(:user, roles: %w(company_admin)) }\n+\n+    { \"homepage#index\" => true,\n+      \"projects#index\" => true,\n+      \"projects#show\" => true,\n+      \"companies#index\" => true,\n+      \"companies#show\" => true,\n+      \"companies/projects#index\" => true,\n+      \"companies/projects#show\" => true,\n+      \"companies/projects#new\" => true,\n+      \"companies/projects#create\" => true,\n+      \"companies/projects#edit\" => true,\n+      \"companies/projects#update\" => true,\n+      \"companies/projects#destroy\" => true,\n+      \"sessions#new\" => true,\n+      \"sessions#create\" => true,\n+      \"sessions#destroy\" => true,\n+      \"users#show\" => true,\n+      \"users#update\" => true,\n+      \"cart_items#index\" => true,\n+      \"cart_items#create\" => true,\n+      \"cart_items#update\" => true,\n+      \"cart_items#destroy\" => true,\n+      \"orders#index\" => true,\n+      \"orders#show\" => true,\n+      \"orders#create\" => true,\n+      \"users#create\" => nil }.each do |pair, result|\n+","path":"spec/models/permission_service_spec.rb","position":458,"original_position":458,"commit_id":"bf2e684bb03e522a55669dff6ec3f3768e74cb71","original_commit_id":"bf2e684bb03e522a55669dff6ec3f3768e74cb71","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Extra empty line detected at block body beginning.","created_at":"2015-08-30T23:47:26Z","updated_at":"2015-08-30T23:47:26Z","html_url":"https://github.com/marlabrizel/the_pivot/pull/61#discussion_r38277848","pull_request_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61","_links":{"self":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/comments/38277848"},"html":{"href":"https://github.com/marlabrizel/the_pivot/pull/61#discussion_r38277848"},"pull_request":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61"}}},"pull_request":{"url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61","id":43721717,"html_url":"https://github.com/marlabrizel/the_pivot/pull/61","diff_url":"https://github.com/marlabrizel/the_pivot/pull/61.diff","patch_url":"https://github.com/marlabrizel/the_pivot/pull/61.patch","issue_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/61","number":61,"state":"open","locked":false,"title":"Company admin can edit projects","user":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"body":"Company admin can edit company's projects\r\nCompany admin can only edit the projects that belong to his/her company\r\nMore model tests for permissions service\r\n\r\ncloses #13 ","created_at":"2015-08-30T22:16:55Z","updated_at":"2015-08-30T23:47:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb2967160a5caad8074eec6a9cb096fa2c204b8e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61/commits","review_comments_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61/comments","review_comment_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/61/comments","statuses_url":"https://api.github.com/repos/marlabrizel/the_pivot/statuses/bf2e684bb03e522a55669dff6ec3f3768e74cb71","head":{"label":"marlabrizel:13-ca-edit-delete-projects","ref":"13-ca-edit-delete-projects","sha":"bf2e684bb03e522a55669dff6ec3f3768e74cb71","user":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"repo":{"id":41321878,"name":"the_pivot","full_name":"marlabrizel/the_pivot","owner":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marlabrizel/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/marlabrizel/the_pivot","forks_url":"https://api.github.com/repos/marlabrizel/the_pivot/forks","keys_url":"https://api.github.com/repos/marlabrizel/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marlabrizel/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marlabrizel/the_pivot/teams","hooks_url":"https://api.github.com/repos/marlabrizel/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/marlabrizel/the_pivot/events","assignees_url":"https://api.github.com/repos/marlabrizel/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/marlabrizel/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/marlabrizel/the_pivot/tags","blobs_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marlabrizel/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/marlabrizel/the_pivot/languages","stargazers_url":"https://api.github.com/repos/marlabrizel/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/marlabrizel/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/marlabrizel/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/marlabrizel/the_pivot/subscription","commits_url":"https://api.github.com/repos/marlabrizel/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/marlabrizel/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/marlabrizel/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/marlabrizel/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marlabrizel/the_pivot/merges","archive_url":"https://api.github.com/repos/marlabrizel/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marlabrizel/the_pivot/downloads","issues_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/marlabrizel/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/marlabrizel/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marlabrizel/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/marlabrizel/the_pivot/releases{/id}","created_at":"2015-08-24T19:09:20Z","updated_at":"2015-08-29T19:05:01Z","pushed_at":"2015-08-30T23:47:22Z","git_url":"git://github.com/marlabrizel/the_pivot.git","ssh_url":"git@github.com:marlabrizel/the_pivot.git","clone_url":"https://github.com/marlabrizel/the_pivot.git","svn_url":"https://github.com/marlabrizel/the_pivot","homepage":"https://codestarter.herokuapp.com","size":5132,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"marlabrizel:master","ref":"master","sha":"31dfae7e4922d03590172f57c2db86c5d6bfe726","user":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"repo":{"id":41321878,"name":"the_pivot","full_name":"marlabrizel/the_pivot","owner":{"login":"marlabrizel","id":6632025,"avatar_url":"https://avatars.githubusercontent.com/u/6632025?v=3","gravatar_id":"","url":"https://api.github.com/users/marlabrizel","html_url":"https://github.com/marlabrizel","followers_url":"https://api.github.com/users/marlabrizel/followers","following_url":"https://api.github.com/users/marlabrizel/following{/other_user}","gists_url":"https://api.github.com/users/marlabrizel/gists{/gist_id}","starred_url":"https://api.github.com/users/marlabrizel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marlabrizel/subscriptions","organizations_url":"https://api.github.com/users/marlabrizel/orgs","repos_url":"https://api.github.com/users/marlabrizel/repos","events_url":"https://api.github.com/users/marlabrizel/events{/privacy}","received_events_url":"https://api.github.com/users/marlabrizel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marlabrizel/the_pivot","description":"","fork":false,"url":"https://api.github.com/repos/marlabrizel/the_pivot","forks_url":"https://api.github.com/repos/marlabrizel/the_pivot/forks","keys_url":"https://api.github.com/repos/marlabrizel/the_pivot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marlabrizel/the_pivot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marlabrizel/the_pivot/teams","hooks_url":"https://api.github.com/repos/marlabrizel/the_pivot/hooks","issue_events_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/events{/number}","events_url":"https://api.github.com/repos/marlabrizel/the_pivot/events","assignees_url":"https://api.github.com/repos/marlabrizel/the_pivot/assignees{/user}","branches_url":"https://api.github.com/repos/marlabrizel/the_pivot/branches{/branch}","tags_url":"https://api.github.com/repos/marlabrizel/the_pivot/tags","blobs_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/refs{/sha}","trees_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marlabrizel/the_pivot/statuses/{sha}","languages_url":"https://api.github.com/repos/marlabrizel/the_pivot/languages","stargazers_url":"https://api.github.com/repos/marlabrizel/the_pivot/stargazers","contributors_url":"https://api.github.com/repos/marlabrizel/the_pivot/contributors","subscribers_url":"https://api.github.com/repos/marlabrizel/the_pivot/subscribers","subscription_url":"https://api.github.com/repos/marlabrizel/the_pivot/subscription","commits_url":"https://api.github.com/repos/marlabrizel/the_pivot/commits{/sha}","git_commits_url":"https://api.github.com/repos/marlabrizel/the_pivot/git/commits{/sha}","comments_url":"https://api.github.com/repos/marlabrizel/the_pivot/comments{/number}","issue_comment_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues/comments{/number}","contents_url":"https://api.github.com/repos/marlabrizel/the_pivot/contents/{+path}","compare_url":"https://api.github.com/repos/marlabrizel/the_pivot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marlabrizel/the_pivot/merges","archive_url":"https://api.github.com/repos/marlabrizel/the_pivot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marlabrizel/the_pivot/downloads","issues_url":"https://api.github.com/repos/marlabrizel/the_pivot/issues{/number}","pulls_url":"https://api.github.com/repos/marlabrizel/the_pivot/pulls{/number}","milestones_url":"https://api.github.com/repos/marlabrizel/the_pivot/milestones{/number}","notifications_url":"https://api.github.com/repos/marlabrizel/the_pivot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marlabrizel/the_pivot/labels{/name}","releases_url":"https://api.github.com/repos/marlabrizel/the_pivot/releases{/id}","created_at":"2015-08-24T19:09:20Z","updated_at":"2015-08-29T19:05:01Z","pushed_at":"2015-08-30T23:47:22Z","git_url":"git://github.com/marlabrizel/the_pivot.git","ssh_url":"git@github.com:marlabrizel/the_pivot.git","clone_url":"https://github.com/marlabrizel/the_pivot.git","svn_url":"https://github.com/marlabrizel/the_pivot","homepage":"https://codestarter.herokuapp.com","size":5132,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61"},"html":{"href":"https://github.com/marlabrizel/the_pivot/pull/61"},"issue":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/issues/61"},"comments":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/issues/61/comments"},"review_comments":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61/comments"},"review_comment":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/pulls/61/commits"},"statuses":{"href":"https://api.github.com/repos/marlabrizel/the_pivot/statuses/bf2e684bb03e522a55669dff6ec3f3768e74cb71"}}}}