Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
2fcf80de
Commit
2fcf80de
authored
Apr 30, 2019
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip whitespace for PipelineSchedule#cron
parent
acb55198
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
app/models/ci/pipeline_schedule.rb
app/models/ci/pipeline_schedule.rb
+3
-0
spec/models/ci/pipeline_schedule_spec.rb
spec/models/ci/pipeline_schedule_spec.rb
+9
-0
No files found.
app/models/ci/pipeline_schedule.rb
View file @
2fcf80de
...
@@ -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
)
}
...
...
spec/models/ci/pipeline_schedule_spec.rb
View file @
2fcf80de
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment