diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-27 16:31:22 +0300 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-30 17:55:09 +0300 |
commit | 3b61451c46f462b392783b282fe63dbddd8b6c2e (patch) | |
tree | ab12ec8d4b49a403fafb6ad1362bc36955cc0661 | |
parent | 63ca126e977666335d7e5f70665815d1289a6f34 (diff) |
Return 202 for destory. Remove []. Remove def pipeline_schedules from helper.
-rw-r--r-- | lib/api/pipeline_schedules.rb | 8 | ||||
-rw-r--r-- | spec/requests/api/pipeline_schedules_spec.rb | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb index 52ad682b972..d9509375698 100644 --- a/lib/api/pipeline_schedules.rb +++ b/lib/api/pipeline_schedules.rb @@ -114,20 +114,16 @@ module API not_found!('PipelineSchedule') unless pipeline_schedule + status :accepted present pipeline_schedule.destroy, with: Entities::PipelineScheduleDetails end end helpers do - def pipeline_schedules - @pipeline_schedules ||= - user_project.pipeline_schedules.preload([:owner, :last_pipeline]) - end - def pipeline_schedule @pipeline_schedule ||= user_project.pipeline_schedules - .preload([:owner, :last_pipeline]) + .preload(:owner, :last_pipeline) .find_by(id: params.delete(:pipeline_schedule_id)) end end diff --git a/spec/requests/api/pipeline_schedules_spec.rb b/spec/requests/api/pipeline_schedules_spec.rb index 77bf377884d..85d11deb26f 100644 --- a/spec/requests/api/pipeline_schedules_spec.rb +++ b/spec/requests/api/pipeline_schedules_spec.rb @@ -267,7 +267,7 @@ describe API::PipelineSchedules do delete api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", master) end.to change { project.pipeline_schedules.count }.by(-1) - expect(response).to have_http_status(:ok) + expect(response).to have_http_status(:accepted) expect(response).to match_response_schema('pipeline_schedule') end |