{"action":"created","comment":{"url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/comments/51336376","id":51336376,"diff_hunk":"@@ -0,0 +1,77 @@\n+# == Schema Information\n+#\n+# Table name: folders\n+#\n+#  id          :integer          not null, primary key\n+#  name        :string(255)\n+#  description :text\n+#  created_at  :datetime         not null\n+#  updated_at  :datetime         not null\n+#  locked      :boolean          default(FALSE)\n+#\n+\n+require 'rails_helper'\n+\n+describe FoldersController, type: :controller do\n+\n+  let!(:admin) {create(:user, :admin)}\n+  let!(:no_access_user) {create(:user, dl_resources: FALSE)}\n+  let!(:dl_resources_user) {create(:user, dl_resources: TRUE, dl_locked_resources: FALSE)}\n+\n+  describe 'GET #show' do\n+\n+    context 'logged in with standard folder access' do\n+      before :each do\n+        allow(controller).to receive(:current_user) { dl_resources_user }\n+      end\n+\n+      it 'is able to view files in standard folders' do\n+        unlocked_folder = create :folder\n+        get :show, id: unlocked_folder\n+        expect(assigns(:folder)).to eq unlocked_folder\n+      end\n+\n+      it 'is NOT able to view files in restricted folders' do\n+        locked_folder = create(:folder, locked: TRUE)\n+        get :show, id: locked_folder\n+        expect(response).to redirect_to folders_path\n+      end\n+    end\n+\n+\n+    context 'logged in without any folder access' do\n+      before :each do\n+        allow(controller).to receive(:current_user) { no_access_user }\n+      end\n+      it 'is NOT able to view files in standard folders' do\n+        unlocked_folder = create :folder\n+        get :show, id: unlocked_folder\n+        expect(response).to redirect_to root_path\n+      end\n+\n+      it 'is NOT able to view files in restricted folders' do\n+        locked_folder = create(:folder, locked: TRUE)\n+        get :show, id: locked_folder\n+        expect(response).to redirect_to root_path\n+      end\n+    end\n+\n+\n+    context 'logged in with restricted folder access' do\n+      before :each do\n+        allow(controller).to receive(:current_user) { admin }\n+      end\n+      it 'is able to view files in standard folders' do\n+        unlocked_folder = create :folder\n+        get :show, id: unlocked_folder\n+        expect(assigns(:folder)).to eq unlocked_folder\n+      end\n+      it 'is able to view files in restricted folders' do\n+        locked_folder = create(:folder, locked: TRUE)","path":"spec/controllers/folders_controller_spec.rb","position":70,"original_position":70,"commit_id":"b61ca7e6d06cfb70b3870bc8405bd010a26ed6cf","original_commit_id":"b61ca7e6d06cfb70b3870bc8405bd010a26ed6cf","user":{"login":"TheDudeWithTheThing","id":410798,"avatar_url":"https://avatars.githubusercontent.com/u/410798?v=3","gravatar_id":"","url":"https://api.github.com/users/TheDudeWithTheThing","html_url":"https://github.com/TheDudeWithTheThing","followers_url":"https://api.github.com/users/TheDudeWithTheThing/followers","following_url":"https://api.github.com/users/TheDudeWithTheThing/following{/other_user}","gists_url":"https://api.github.com/users/TheDudeWithTheThing/gists{/gist_id}","starred_url":"https://api.github.com/users/TheDudeWithTheThing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheDudeWithTheThing/subscriptions","organizations_url":"https://api.github.com/users/TheDudeWithTheThing/orgs","repos_url":"https://api.github.com/users/TheDudeWithTheThing/repos","events_url":"https://api.github.com/users/TheDudeWithTheThing/events{/privacy}","received_events_url":"https://api.github.com/users/TheDudeWithTheThing/received_events","type":"User","site_admin":false},"body":"you could turn these into traits in the factory so you can do\r\n\r\n`create(:folder, :locked)`\r\n`create(:folder, :unlocked)`","created_at":"2016-01-30T01:16:31Z","updated_at":"2016-01-30T01:16:31Z","html_url":"https://github.com/ophrescue/RescueRails/pull/431#discussion_r51336376","pull_request_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431","_links":{"self":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/comments/51336376"},"html":{"href":"https://github.com/ophrescue/RescueRails/pull/431#discussion_r51336376"},"pull_request":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431"}}},"pull_request":{"url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431","id":57131765,"html_url":"https://github.com/ophrescue/RescueRails/pull/431","diff_url":"https://github.com/ophrescue/RescueRails/pull/431.diff","patch_url":"https://github.com/ophrescue/RescueRails/pull/431.patch","issue_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/431","number":431,"state":"open","locked":false,"title":"Staff Resource Restrictions","user":{"login":"markottaviani","id":793671,"avatar_url":"https://avatars.githubusercontent.com/u/793671?v=3","gravatar_id":"","url":"https://api.github.com/users/markottaviani","html_url":"https://github.com/markottaviani","followers_url":"https://api.github.com/users/markottaviani/followers","following_url":"https://api.github.com/users/markottaviani/following{/other_user}","gists_url":"https://api.github.com/users/markottaviani/gists{/gist_id}","starred_url":"https://api.github.com/users/markottaviani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markottaviani/subscriptions","organizations_url":"https://api.github.com/users/markottaviani/orgs","repos_url":"https://api.github.com/users/markottaviani/repos","events_url":"https://api.github.com/users/markottaviani/events{/privacy}","received_events_url":"https://api.github.com/users/markottaviani/received_events","type":"User","site_admin":false},"body":"Implements #404 \r\n\r\nReady to Merge","created_at":"2016-01-25T21:16:15Z","updated_at":"2016-01-30T01:16:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3619a9fe2c4875b92a67d479bc1624d02a0937cc","assignee":{"login":"TheDudeWithTheThing","id":410798,"avatar_url":"https://avatars.githubusercontent.com/u/410798?v=3","gravatar_id":"","url":"https://api.github.com/users/TheDudeWithTheThing","html_url":"https://github.com/TheDudeWithTheThing","followers_url":"https://api.github.com/users/TheDudeWithTheThing/followers","following_url":"https://api.github.com/users/TheDudeWithTheThing/following{/other_user}","gists_url":"https://api.github.com/users/TheDudeWithTheThing/gists{/gist_id}","starred_url":"https://api.github.com/users/TheDudeWithTheThing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheDudeWithTheThing/subscriptions","organizations_url":"https://api.github.com/users/TheDudeWithTheThing/orgs","repos_url":"https://api.github.com/users/TheDudeWithTheThing/repos","events_url":"https://api.github.com/users/TheDudeWithTheThing/events{/privacy}","received_events_url":"https://api.github.com/users/TheDudeWithTheThing/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431/commits","review_comments_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431/comments","review_comment_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/431/comments","statuses_url":"https://api.github.com/repos/ophrescue/RescueRails/statuses/b61ca7e6d06cfb70b3870bc8405bd010a26ed6cf","head":{"label":"ophrescue:resources","ref":"resources","sha":"b61ca7e6d06cfb70b3870bc8405bd010a26ed6cf","user":{"login":"ophrescue","id":1580124,"avatar_url":"https://avatars.githubusercontent.com/u/1580124?v=3","gravatar_id":"","url":"https://api.github.com/users/ophrescue","html_url":"https://github.com/ophrescue","followers_url":"https://api.github.com/users/ophrescue/followers","following_url":"https://api.github.com/users/ophrescue/following{/other_user}","gists_url":"https://api.github.com/users/ophrescue/gists{/gist_id}","starred_url":"https://api.github.com/users/ophrescue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ophrescue/subscriptions","organizations_url":"https://api.github.com/users/ophrescue/orgs","repos_url":"https://api.github.com/users/ophrescue/repos","events_url":"https://api.github.com/users/ophrescue/events{/privacy}","received_events_url":"https://api.github.com/users/ophrescue/received_events","type":"Organization","site_admin":false},"repo":{"id":2482127,"name":"RescueRails","full_name":"ophrescue/RescueRails","owner":{"login":"ophrescue","id":1580124,"avatar_url":"https://avatars.githubusercontent.com/u/1580124?v=3","gravatar_id":"","url":"https://api.github.com/users/ophrescue","html_url":"https://github.com/ophrescue","followers_url":"https://api.github.com/users/ophrescue/followers","following_url":"https://api.github.com/users/ophrescue/following{/other_user}","gists_url":"https://api.github.com/users/ophrescue/gists{/gist_id}","starred_url":"https://api.github.com/users/ophrescue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ophrescue/subscriptions","organizations_url":"https://api.github.com/users/ophrescue/orgs","repos_url":"https://api.github.com/users/ophrescue/repos","events_url":"https://api.github.com/users/ophrescue/events{/privacy}","received_events_url":"https://api.github.com/users/ophrescue/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ophrescue/RescueRails","description":"Helps save cute cuddly puppies!","fork":false,"url":"https://api.github.com/repos/ophrescue/RescueRails","forks_url":"https://api.github.com/repos/ophrescue/RescueRails/forks","keys_url":"https://api.github.com/repos/ophrescue/RescueRails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ophrescue/RescueRails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ophrescue/RescueRails/teams","hooks_url":"https://api.github.com/repos/ophrescue/RescueRails/hooks","issue_events_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/events{/number}","events_url":"https://api.github.com/repos/ophrescue/RescueRails/events","assignees_url":"https://api.github.com/repos/ophrescue/RescueRails/assignees{/user}","branches_url":"https://api.github.com/repos/ophrescue/RescueRails/branches{/branch}","tags_url":"https://api.github.com/repos/ophrescue/RescueRails/tags","blobs_url":"https://api.github.com/repos/ophrescue/RescueRails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ophrescue/RescueRails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ophrescue/RescueRails/git/refs{/sha}","trees_url":"https://api.github.com/repos/ophrescue/RescueRails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ophrescue/RescueRails/statuses/{sha}","languages_url":"https://api.github.com/repos/ophrescue/RescueRails/languages","stargazers_url":"https://api.github.com/repos/ophrescue/RescueRails/stargazers","contributors_url":"https://api.github.com/repos/ophrescue/RescueRails/contributors","subscribers_url":"https://api.github.com/repos/ophrescue/RescueRails/subscribers","subscription_url":"https://api.github.com/repos/ophrescue/RescueRails/subscription","commits_url":"https://api.github.com/repos/ophrescue/RescueRails/commits{/sha}","git_commits_url":"https://api.github.com/repos/ophrescue/RescueRails/git/commits{/sha}","comments_url":"https://api.github.com/repos/ophrescue/RescueRails/comments{/number}","issue_comment_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/comments{/number}","contents_url":"https://api.github.com/repos/ophrescue/RescueRails/contents/{+path}","compare_url":"https://api.github.com/repos/ophrescue/RescueRails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ophrescue/RescueRails/merges","archive_url":"https://api.github.com/repos/ophrescue/RescueRails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ophrescue/RescueRails/downloads","issues_url":"https://api.github.com/repos/ophrescue/RescueRails/issues{/number}","pulls_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls{/number}","milestones_url":"https://api.github.com/repos/ophrescue/RescueRails/milestones{/number}","notifications_url":"https://api.github.com/repos/ophrescue/RescueRails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ophrescue/RescueRails/labels{/name}","releases_url":"https://api.github.com/repos/ophrescue/RescueRails/releases{/id}","deployments_url":"https://api.github.com/repos/ophrescue/RescueRails/deployments","created_at":"2011-09-29T13:39:56Z","updated_at":"2015-06-20T22:38:02Z","pushed_at":"2016-01-30T00:21:35Z","git_url":"git://github.com/ophrescue/RescueRails.git","ssh_url":"git@github.com:ophrescue/RescueRails.git","clone_url":"https://github.com/ophrescue/RescueRails.git","svn_url":"https://github.com/ophrescue/RescueRails","homepage":"http://ophrescue.org","size":9999,"stargazers_count":9,"watchers_count":9,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":29,"forks":6,"open_issues":29,"watchers":9,"default_branch":"master"}},"base":{"label":"ophrescue:master","ref":"master","sha":"f81f511de07154c93a196937a4359e074644a2c6","user":{"login":"ophrescue","id":1580124,"avatar_url":"https://avatars.githubusercontent.com/u/1580124?v=3","gravatar_id":"","url":"https://api.github.com/users/ophrescue","html_url":"https://github.com/ophrescue","followers_url":"https://api.github.com/users/ophrescue/followers","following_url":"https://api.github.com/users/ophrescue/following{/other_user}","gists_url":"https://api.github.com/users/ophrescue/gists{/gist_id}","starred_url":"https://api.github.com/users/ophrescue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ophrescue/subscriptions","organizations_url":"https://api.github.com/users/ophrescue/orgs","repos_url":"https://api.github.com/users/ophrescue/repos","events_url":"https://api.github.com/users/ophrescue/events{/privacy}","received_events_url":"https://api.github.com/users/ophrescue/received_events","type":"Organization","site_admin":false},"repo":{"id":2482127,"name":"RescueRails","full_name":"ophrescue/RescueRails","owner":{"login":"ophrescue","id":1580124,"avatar_url":"https://avatars.githubusercontent.com/u/1580124?v=3","gravatar_id":"","url":"https://api.github.com/users/ophrescue","html_url":"https://github.com/ophrescue","followers_url":"https://api.github.com/users/ophrescue/followers","following_url":"https://api.github.com/users/ophrescue/following{/other_user}","gists_url":"https://api.github.com/users/ophrescue/gists{/gist_id}","starred_url":"https://api.github.com/users/ophrescue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ophrescue/subscriptions","organizations_url":"https://api.github.com/users/ophrescue/orgs","repos_url":"https://api.github.com/users/ophrescue/repos","events_url":"https://api.github.com/users/ophrescue/events{/privacy}","received_events_url":"https://api.github.com/users/ophrescue/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ophrescue/RescueRails","description":"Helps save cute cuddly puppies!","fork":false,"url":"https://api.github.com/repos/ophrescue/RescueRails","forks_url":"https://api.github.com/repos/ophrescue/RescueRails/forks","keys_url":"https://api.github.com/repos/ophrescue/RescueRails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ophrescue/RescueRails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ophrescue/RescueRails/teams","hooks_url":"https://api.github.com/repos/ophrescue/RescueRails/hooks","issue_events_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/events{/number}","events_url":"https://api.github.com/repos/ophrescue/RescueRails/events","assignees_url":"https://api.github.com/repos/ophrescue/RescueRails/assignees{/user}","branches_url":"https://api.github.com/repos/ophrescue/RescueRails/branches{/branch}","tags_url":"https://api.github.com/repos/ophrescue/RescueRails/tags","blobs_url":"https://api.github.com/repos/ophrescue/RescueRails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ophrescue/RescueRails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ophrescue/RescueRails/git/refs{/sha}","trees_url":"https://api.github.com/repos/ophrescue/RescueRails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ophrescue/RescueRails/statuses/{sha}","languages_url":"https://api.github.com/repos/ophrescue/RescueRails/languages","stargazers_url":"https://api.github.com/repos/ophrescue/RescueRails/stargazers","contributors_url":"https://api.github.com/repos/ophrescue/RescueRails/contributors","subscribers_url":"https://api.github.com/repos/ophrescue/RescueRails/subscribers","subscription_url":"https://api.github.com/repos/ophrescue/RescueRails/subscription","commits_url":"https://api.github.com/repos/ophrescue/RescueRails/commits{/sha}","git_commits_url":"https://api.github.com/repos/ophrescue/RescueRails/git/commits{/sha}","comments_url":"https://api.github.com/repos/ophrescue/RescueRails/comments{/number}","issue_comment_url":"https://api.github.com/repos/ophrescue/RescueRails/issues/comments{/number}","contents_url":"https://api.github.com/repos/ophrescue/RescueRails/contents/{+path}","compare_url":"https://api.github.com/repos/ophrescue/RescueRails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ophrescue/RescueRails/merges","archive_url":"https://api.github.com/repos/ophrescue/RescueRails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ophrescue/RescueRails/downloads","issues_url":"https://api.github.com/repos/ophrescue/RescueRails/issues{/number}","pulls_url":"https://api.github.com/repos/ophrescue/RescueRails/pulls{/number}","milestones_url":"https://api.github.com/repos/ophrescue/RescueRails/milestones{/number}","notifications_url":"https://api.github.com/repos/ophrescue/RescueRails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ophrescue/RescueRails/labels{/name}","releases_url":"https://api.github.com/repos/ophrescue/RescueRails/releases{/id}","deployments_url":"https://api.github.com/repos/ophrescue/RescueRails/deployments","created_at":"2011-09-29T13:39:56Z","updated_at":"2015-06-20T22:38:02Z","pushed_at":"2016-01-30T00:21:35Z","git_url":"git://github.com/ophrescue/RescueRails.git","ssh_url":"git@github.com:ophrescue/RescueRails.git","clone_url":"https://github.com/ophrescue/RescueRails.git","svn_url":"https://github.com/ophrescue/RescueRails","homepage":"http://ophrescue.org","size":9999,"stargazers_count":9,"watchers_count":9,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":29,"forks":6,"open_issues":29,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431"},"html":{"href":"https://github.com/ophrescue/RescueRails/pull/431"},"issue":{"href":"https://api.github.com/repos/ophrescue/RescueRails/issues/431"},"comments":{"href":"https://api.github.com/repos/ophrescue/RescueRails/issues/431/comments"},"review_comments":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431/comments"},"review_comment":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ophrescue/RescueRails/pulls/431/commits"},"statuses":{"href":"https://api.github.com/repos/ophrescue/RescueRails/statuses/b61ca7e6d06cfb70b3870bc8405bd010a26ed6cf"}}}}