diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-17 21:26:18 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-30 23:55:09 +0900 |
commit | df6040bbd41a639b3d0aa339b2dc0e84d67b811b (patch) | |
tree | ce38cc4c45b360436ec3fa4d850ef46281415e2c | |
parent | c7fc65e0672a3c88e15f033be3b4d4258bc36e2f (diff) | |
download | gitlab-ce-df6040bbd41a639b3d0aa339b2dc0e84d67b811b.tar.gz |
zj keen eye2
-rw-r--r-- | lib/api/pipeline_schedules.rb | 3 | ||||
-rw-r--r-- | spec/requests/api/pipeline_schedules_spec.rb | 7 |
2 files changed, 2 insertions, 8 deletions
diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb index 9429306fe20..58888417888 100644 --- a/lib/api/pipeline_schedules.rb +++ b/lib/api/pipeline_schedules.rb @@ -54,7 +54,7 @@ module API .new(user_project, current_user, declared_params(include_missing: false)) .execute - if pipeline_schedule.valid? + if pipeline_schedule.persisted? present pipeline_schedule, with: Entities::PipelineSchedule else render_validation_error!(pipeline_schedule) @@ -98,7 +98,6 @@ module API return not_found!('PipelineSchedule') unless pipeline_schedule if pipeline_schedule.own!(current_user) - status :ok present pipeline_schedule, with: Entities::PipelineSchedule else render_validation_error!(pipeline_schedule) diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 7b7bdbc7c74..34c4fcfcae1 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -160,15 +160,10 @@ describe API::PipelineSchedules do it 'updates cron' do put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", developer), cron: '1 2 3 4 *' - pipeline_schedule.reload expect(response).to have_http_status(:ok) expect(response).to match_response_schema('pipeline_schedule') expect(json_response['cron']).to eq('1 2 3 4 *') - expect(pipeline_schedule.next_run_at.min).to eq(1) - expect(pipeline_schedule.next_run_at.hour).to eq(2) - expect(pipeline_schedule.next_run_at.day).to eq(3) - expect(pipeline_schedule.next_run_at.month).to eq(4) end context 'when cron has validation error' do @@ -208,7 +203,7 @@ describe API::PipelineSchedules do it 'updates owner' do post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/take_ownership", developer) - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(:created) expect(response).to match_response_schema('pipeline_schedule') end end |