提交 51a61e53 编写于 作者: J jhampton

Fixes broken tests

- Adjusts behavior to cover conditional trigger variable values
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册