Commit df6040bb authored by Shinya Maeda's avatar Shinya Maeda

zj keen eye2

parent c7fc65e0
...@@ -54,7 +54,7 @@ module API ...@@ -54,7 +54,7 @@ module API
.new(user_project, current_user, declared_params(include_missing: false)) .new(user_project, current_user, declared_params(include_missing: false))
.execute .execute
if pipeline_schedule.valid? if pipeline_schedule.persisted?
present pipeline_schedule, with: Entities::PipelineSchedule present pipeline_schedule, with: Entities::PipelineSchedule
else else
render_validation_error!(pipeline_schedule) render_validation_error!(pipeline_schedule)
...@@ -98,7 +98,6 @@ module API ...@@ -98,7 +98,6 @@ module API
return not_found!('PipelineSchedule') unless pipeline_schedule return not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.own!(current_user) if pipeline_schedule.own!(current_user)
status :ok
present pipeline_schedule, with: Entities::PipelineSchedule present pipeline_schedule, with: Entities::PipelineSchedule
else else
render_validation_error!(pipeline_schedule) render_validation_error!(pipeline_schedule)
......
...@@ -160,15 +160,10 @@ describe API::PipelineSchedules do ...@@ -160,15 +160,10 @@ describe API::PipelineSchedules do
it 'updates cron' do it 'updates cron' do
put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", developer), put api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}", developer),
cron: '1 2 3 4 *' cron: '1 2 3 4 *'
pipeline_schedule.reload
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
expect(response).to match_response_schema('pipeline_schedule') expect(response).to match_response_schema('pipeline_schedule')
expect(json_response['cron']).to eq('1 2 3 4 *') 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 end
context 'when cron has validation error' do context 'when cron has validation error' do
...@@ -208,7 +203,7 @@ describe API::PipelineSchedules do ...@@ -208,7 +203,7 @@ describe API::PipelineSchedules do
it 'updates owner' do it 'updates owner' do
post api("/projects/#{project.id}/pipeline_schedules/#{pipeline_schedule.id}/take_ownership", developer) 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') expect(response).to match_response_schema('pipeline_schedule')
end end
end end
......
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