diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2017-06-13 11:07:38 +0300 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2017-06-13 11:07:38 +0300 |
commit | 23557433b16e03beb3e8bb94b6fc26164de639d0 (patch) | |
tree | 8d1f1695241d84cf85c9c29121ba5ea335ec1ef3 /spec | |
parent | 670d8df5acb3b1ba84dc56953278be09bb2a1799 (diff) | |
parent | 34655464133921e4dcfed429566271da7f05046b (diff) |
Merge remote-tracking branch 'origin/fix-9-2-stable-conflicts-for-mr-11706' into 9-2-stable
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 a521222fc9c..39b4dd7235b 100644 --- a/spec/features/projects/pipeline_schedules_spec.rb +++ b/spec/features/projects/pipeline_schedules_spec.rb @@ -66,6 +66,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 @@ -109,6 +120,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 |