Commit b02012e8 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents bc2b3171 bd73925b
...@@ -5,6 +5,7 @@ module Ci ...@@ -5,6 +5,7 @@ module Ci
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include Importable include Importable
include IgnorableColumn include IgnorableColumn
include StripAttribute
ignore_column :deleted_at ignore_column :deleted_at
...@@ -22,6 +23,8 @@ module Ci ...@@ -22,6 +23,8 @@ module Ci
before_save :set_next_run_at before_save :set_next_run_at
strip_attributes :cron
scope :active, -> { where(active: true) } scope :active, -> { where(active: true) }
scope :inactive, -> { where(active: false) } scope :inactive, -> { where(active: false) }
......
...@@ -35,6 +35,15 @@ describe Ci::PipelineSchedule do ...@@ -35,6 +35,15 @@ describe Ci::PipelineSchedule do
expect(pipeline_schedule).not_to be_valid expect(pipeline_schedule).not_to be_valid
end end
end end
context 'when cron contains trailing whitespaces' do
it 'strips the attribute' do
pipeline_schedule = build(:ci_pipeline_schedule, cron: ' 0 0 * * * ')
expect(pipeline_schedule).to be_valid
expect(pipeline_schedule.cron).to eq('0 0 * * *')
end
end
end end
describe '#set_next_run_at' do describe '#set_next_run_at' do
......
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