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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
62480461
Commit
62480461
authored
Apr 01, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed failed tests
parent
d9574c0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
spec/models/ci/trigger_schedule_spec.rb
spec/models/ci/trigger_schedule_spec.rb
+10
-12
No files found.
spec/models/ci/trigger_schedule_spec.rb
View file @
62480461
...
...
@@ -21,7 +21,7 @@ describe Ci::TriggerSchedule, models: true do
trigger_schedule
.
valid?
end
context
'when
every hour
'
do
context
'when
cron frequency is too short
'
do
let
(
:cron
)
{
'0 * * * *'
}
# 00:00, 01:00, 02:00, ..., 23:00
it
'gets an error'
do
...
...
@@ -29,8 +29,8 @@ describe Ci::TriggerSchedule, models: true do
end
end
context
'when
each six hours
'
do
let
(
:cron
)
{
'0
*/6 * * *'
}
# 00:00, 06:00, 12:00, 18:00
context
'when
cron frequency is eligible
'
do
let
(
:cron
)
{
'0
0 1 1 *'
}
# every 00:00, January 1st
it
'gets no errors'
do
expect
(
trigger_schedule
.
errors
[
:cron
]).
to
be_empty
...
...
@@ -39,17 +39,15 @@ describe Ci::TriggerSchedule, models: true do
end
describe
'#schedule_next_run!'
do
context
'when more_than_1_hour_from_now'
do
let
(
:trigger_schedule
)
{
create
(
:ci_trigger_schedule
,
:cron_nightly_build
)
}
let
(
:trigger_schedule
)
{
create
(
:ci_trigger_schedule
,
:cron_nightly_build
)
}
before
do
trigger_schedule
.
schedule_next_run!
end
before
do
trigger_schedule
.
schedule_next_run!
end
it
'updates next_run_at'
do
next_time
=
Ci
::
CronParser
.
new
(
trigger_schedule
.
cron
,
trigger_schedule
.
cron_time_zone
).
next_time_from
(
Time
.
now
)
expect
(
Ci
::
TriggerSchedule
.
last
.
next_run_at
).
to
eq
(
next_time
)
end
it
'updates next_run_at'
do
next_time
=
Ci
::
CronParser
.
new
(
trigger_schedule
.
cron
,
trigger_schedule
.
cron_time_zone
).
next_time_from
(
Time
.
now
)
expect
(
Ci
::
TriggerSchedule
.
last
.
next_run_at
).
to
eq
(
next_time
)
end
end
end
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