summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorJohn Jarvis <jarv@gitlab.com>2019-01-01 20:38:21 +0000
committerJohn Jarvis <jarv@gitlab.com>2019-01-01 20:38:21 +0000
commit9929351b59fba345b288f016238bd6417128353a (patch)
tree923d039dfadd62af0377ae28031bb7f5a1f0638f /spec/requests
parent1f7b0572d08f726dc224d51c85f7d91bd29a41fa (diff)
parente783ad5b7ad16409a49afd10fa859dd19115164b (diff)
downloadgitlab-ce-9929351b59fba345b288f016238bd6417128353a.tar.gz
Merge branch 'security-master-guests-jobs-api' into 'master'
[master] Guest users have access to all Job information via the API See merge request gitlab/gitlabhq!2717
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/jobs_spec.rb32
1 files changed, 26 insertions, 6 deletions
diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb
index 73131dba542..97aa71bf231 100644
--- a/spec/requests/api/jobs_spec.rb
+++ b/spec/requests/api/jobs_spec.rb
@@ -142,10 +142,20 @@ describe API::Jobs do
end
context 'unauthorized user' do
- let(:api_user) { nil }
+ context 'when user is not logged in' do
+ let(:api_user) { nil }
- it 'does not return project jobs' do
- expect(response).to have_gitlab_http_status(401)
+ it 'does not return project jobs' do
+ expect(response).to have_gitlab_http_status(401)
+ end
+ end
+
+ context 'when user is guest' do
+ let(:api_user) { guest }
+
+ it 'does not return project jobs' do
+ expect(response).to have_gitlab_http_status(403)
+ end
end
end
@@ -241,10 +251,20 @@ describe API::Jobs do
end
context 'unauthorized user' do
- let(:api_user) { nil }
+ context 'when user is not logged in' do
+ let(:api_user) { nil }
- it 'does not return jobs' do
- expect(response).to have_gitlab_http_status(401)
+ it 'does not return jobs' do
+ expect(response).to have_gitlab_http_status(401)
+ end
+ end
+
+ context 'when user is guest' do
+ let(:api_user) { guest }
+
+ it 'does not return jobs' do
+ expect(response).to have_gitlab_http_status(403)
+ end
end
end
end