Commit 51a61e53 authored by jhampton's avatar jhampton

Fixes broken tests

- Adjusts behavior to cover conditional trigger variable values
parent b6600129
......@@ -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)
......
......@@ -354,7 +354,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
create(:ci_build, pipeline: pipeline, trigger_request: trigger_request)
end
shared_examples 'job with outdated deployment' do
it 'shows a link for the job' do
expect(page).to have_content('Token')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment