diff options
author | jhampton <jhampton@gitlab.com> | 2018-12-06 16:08:02 +0300 |
---|---|---|
committer | jhampton <jhampton@gitlab.com> | 2018-12-06 16:08:02 +0300 |
commit | 51a61e53b2b6bc4d6224332a01848f80699d4b28 (patch) | |
tree | 678368bb4ad4f05cd8c54b93c2e9e359529c3d5f /spec/controllers/projects | |
parent | b6600129bfaa4c8667e06016f546ac71d03f1bf4 (diff) |
Fixes broken tests
- Adjusts behavior to cover conditional trigger variable values
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/jobs_controller_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index da3d658d061..8fd8af9360c 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -400,6 +400,7 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do context 'with variables' do before do + project.add_maintainer(user) create(:ci_pipeline_variable, pipeline: pipeline, key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1') get_show(id: job.id, format: :json) @@ -415,6 +416,24 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do expect(json_response['trigger']['variables'].first['public']).to eq false end end + + context 'with no variable values' do + before do + create(:ci_pipeline_variable, pipeline: pipeline, key: :TRIGGER_KEY_1, value: 'TRIGGER_VALUE_1') + + get_show(id: job.id, format: :json) + 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 be_nil + expect(json_response['trigger']['variables'].first['public']).to eq false + end + end end def get_show(**extra_params) |