summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-08-04 02:23:02 +0900
committerShinya Maeda <shinya@gitlab.com>2017-08-04 18:14:48 +0900
commit0c75e23fab61e34bb45343776e31cad4ea3e4ae6 (patch)
tree2be50110a8fa2c60f7171beced0e43ec31c2247d
parent93e96c3fcf30c476df332a7e5e762134ffb5da3e (diff)
downloadgitlab-ce-0c75e23fab61e34bb45343776e31cad4ea3e4ae6.tar.gz
fix
-rw-r--r--app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml2
-rw-r--r--spec/features/projects/pipeline_schedules_spec.rb23
2 files changed, 24 insertions, 1 deletions
diff --git a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml
index 7343d6e039c..bd8c38292d6 100644
--- a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml
+++ b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml
@@ -15,7 +15,7 @@
- else
= s_("PipelineSchedules|None")
%td.next-run-cell
- - if pipeline_schedule.active?
+ - if pipeline_schedule.active? && pipeline_schedule.next_run_at
= time_ago_with_tooltip(pipeline_schedule.real_next_run)
- else
= s_("PipelineSchedules|Inactive")
diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb
index 605415d2af4..280c8a183e6 100644
--- a/spec/features/projects/pipeline_schedules_spec.rb
+++ b/spec/features/projects/pipeline_schedules_spec.rb
@@ -219,6 +219,29 @@ feature 'Pipeline Schedules', :js do
end
end
end
+
+ context 'when active is true and next_run_at is NULL' do
+ background do
+ create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
+ pipeline_schedule.update_attribute(:cron, nil) # Consequently next_run_at will be nil
+ pipeline_schedule.reload
+ expect(pipeline_schedule.active).to be_truthy
+ expect(pipeline_schedule.next_run_at).to be_nil
+ end
+
+ visit_pipelines_schedules
+ find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
+ end
+
+ scenario 'user edit and recover the problematic pipeline schedule' do
+ expect(find("#schedule_cron").value).to eq('')
+ fill_in 'schedule_cron', with: '* 1 2 3 4'
+ click_button 'Save pipeline schedule'
+ page.within('.pipeline-schedule-table-row:nth-child(1)') do
+ expect(page).to have_css(".next-run-cell time")
+ end
+ end
+ end
end
context 'logged in as non-member' do