diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-05-29 20:46:56 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-05-29 20:46:56 +0000 |
commit | 9dfecec53d907a8beb6c2f119d6688aa92c959fd (patch) | |
tree | 0728951313104887c19f17c5664f5ccabb3b6a7f /spec | |
parent | 1ac12698c613774bdace72475573916c142a07e4 (diff) | |
parent | d94e1aad57d79d93d0add92aa1887c50ee2b27f2 (diff) | |
download | gitlab-ce-9dfecec53d907a8beb6c2f119d6688aa92c959fd.tar.gz |
Merge branch '32790-pipeline_schedules-pages-throwing-error-500' into 'master'
Resolve "pipeline_schedules pages throwing error 500"
Closes #32790
See merge request !11706
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/projects/pipeline_schedules_spec.rb | 24 | ||||
-rw-r--r-- | spec/models/ci/pipeline_schedule_spec.rb | 8 |
2 files changed, 32 insertions, 0 deletions
diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb index f40e1bc4930..317949d6b56 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -65,6 +65,17 @@ feature 'Pipeline Schedules', :feature do expect(page).not_to have_content('pipeline schedule') end end + + context 'when ref is nil' do + before do + pipeline_schedule.update_attribute(:ref, nil) + visit_pipelines_schedules + end + + it 'shows a list of the pipeline schedules with empty ref column' do + expect(first('.branch-name-cell').text).to eq('') + end + end end describe 'POST /projects/pipeline_schedules/new', js: true do @@ -108,6 +119,19 @@ feature 'Pipeline Schedules', :feature do expect(page).to have_content('my brand new description') end + + context 'when ref is nil' do + before do + pipeline_schedule.update_attribute(:ref, nil) + edit_pipeline_schedule + end + + it 'shows the pipeline schedule with default ref' do + page.within('.git-revision-dropdown-toggle') do + expect(first('.dropdown-toggle-text').text).to eq('master') + end + end + end end def visit_new_pipeline_schedule diff --git a/spec/models/ci/pipeline_schedule_spec.rb b/spec/models/ci/pipeline_schedule_spec.rb index 822b98c5f6c..b00e7a73571 100644 --- a/spec/models/ci/pipeline_schedule_spec.rb +++ b/spec/models/ci/pipeline_schedule_spec.rb @@ -25,6 +25,14 @@ describe Ci::PipelineSchedule, models: true do expect(pipeline_schedule).not_to be_valid end + + context 'when active is false' do + it 'does not allow nullified ref' do + pipeline_schedule = build(:ci_pipeline_schedule, :inactive, ref: nil) + + expect(pipeline_schedule).not_to be_valid + end + end end describe '#set_next_run_at' do |