diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-12-07 23:14:02 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-12-07 23:14:02 +0300 |
commit | abeeb24c5b2db3629d627538dc2f27fb02e01f66 (patch) | |
tree | 387c3308f1c385334d1e35e1a4b8adfb0c7ae20a /spec/controllers | |
parent | 8fd72c63e2ecc41779dcd99c2b60e57b01bc3000 (diff) | |
parent | 6de31cddb81613045ae4ac920a054c53f2028949 (diff) |
Merge branch '20422-hide-ui-variables-by-default' into 'master'
Resolve "Hide variables in UI by default"
Closes #20422
See merge request gitlab-org/gitlab-ce!23518
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/jobs_controller_spec.rb | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 51a7cc63cef..fca313dafb1 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -401,18 +401,56 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'with variables' do before do create(:ci_pipeline_variable, pipeline: pipeline, key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1') + end - get_show(id: job.id, format: :json) + context 'user is a maintainer' do + before do + project.add_maintainer(user) + + get_show(id: job.id, format: :json) + end + + it 'returns a job_detail' do + expect(response).to have_gitlab_http_status(:ok) + expect(response).to match_response_schema('job/job_details') + end + + it 'exposes trigger information and variables' do + expect(json_response['trigger']['short_token']).to eq 'toke' + expect(json_response['trigger']['variables'].length).to eq 1 + end + + it 'exposes correct variable properties' do + first_variable = json_response['trigger']['variables'].first + + expect(first_variable['key']).to eq "TRIGGER_KEY_1" + expect(first_variable['value']).to eq "TRIGGER_VALUE_1" + expect(first_variable['public']).to eq false + end end - it 'exposes trigger information and variables' do - expect(response).to have_gitlab_http_status(:ok) - expect(response).to match_response_schema('job/job_details') - expect(json_response['trigger']['short_token']).to eq 'toke' - expect(json_response['trigger']['variables'].length).to eq 1 - expect(json_response['trigger']['variables'].first['key']).to eq "TRIGGER_KEY_1" - expect(json_response['trigger']['variables'].first['value']).to eq "TRIGGER_VALUE_1" - expect(json_response['trigger']['variables'].first['public']).to eq false + context 'user is not a mantainer' do + before do + get_show(id: job.id, format: :json) + end + + it 'returns a job_detail' do + expect(response).to have_gitlab_http_status(:ok) + expect(response).to match_response_schema('job/job_details') + end + + it 'exposes trigger information and variables' do + expect(json_response['trigger']['short_token']).to eq 'toke' + expect(json_response['trigger']['variables'].length).to eq 1 + end + + it 'exposes correct variable properties' do + first_variable = json_response['trigger']['variables'].first + + expect(first_variable['key']).to eq "TRIGGER_KEY_1" + expect(first_variable['value']).to be_nil + expect(first_variable['public']).to eq false + end end end end |