diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-08-22 21:42:17 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-04 21:10:34 +0900 |
commit | fb8f32a92cdfe4cca24cb80a91e8fe48d6b0df25 (patch) | |
tree | 5d2d0d089039e1f84b34143d18e20ec39f77c9c5 /spec/requests | |
parent | 03f72f0f419b7e05fe9207c90b92b02ef7291cd1 (diff) | |
download | gitlab-ce-fb8f32a92cdfe4cca24cb80a91e8fe48d6b0df25.tar.gz |
Finish spec
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/pipeline_schedules_spec.rb | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index e55e3617b5a..8239c26facd 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -330,7 +330,7 @@ describe API::PipelineSchedules do end end - context 'when cron has validation error' do + context 'when key has validation error' do it 'does not create pipeline_schedule_variable' do post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables", developer), params.merge('key' => '!?!?') @@ -368,23 +368,13 @@ describe API::PipelineSchedules do end context 'authenticated user with valid permissions' do - it 'updates cron' do + it 'updates pipeline_schedule_variable' do put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer), - key: pipeline_schedule_variable.key, value: 'updated_value' + value: 'updated_value' expect(response).to have_http_status(:ok) expect(response).to match_response_schema('pipeline_schedule_variable') - expect(json_response['key']).to eq('updated_value') - end - - context 'when cron has validation error' do - it 'does not update pipeline_schedule_variable' do - put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", developer), - key: '!?!?' - - expect(response).to have_http_status(:bad_request) - expect(json_response['message']).to have_key('key') - end + expect(json_response['value']).to eq('updated_value') end end @@ -412,7 +402,7 @@ describe API::PipelineSchedules do create(:ci_pipeline_schedule, project: project, owner: developer) end - let(:pipeline_schedule_variable) do + let!(:pipeline_schedule_variable) do create(:ci_pipeline_schedule_variable, pipeline_schedule: pipeline_schedule) end @@ -424,7 +414,7 @@ describe API::PipelineSchedules do it 'deletes pipeline_schedule_variable' do expect do delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/variables/#{pipeline_schedule_variable.key}", master) - end.to change { project.pipeline_schedules.count }.by(-1) + end.to change { Ci::PipelineScheduleVariable.count }.by(-1) expect(response).to have_http_status(:accepted) expect(response).to match_response_schema('pipeline_schedule_variable') |