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
1dbc888e
Commit
1dbc888e
authored
Apr 05, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove TriggerSchedulePresenter. This will go in another MR.
parent
f229290a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
76 deletions
+0
-76
app/models/ci/trigger_schedule.rb
app/models/ci/trigger_schedule.rb
+0
-1
app/presenters/ci/trigger_schedule_presenter.rb
app/presenters/ci/trigger_schedule_presenter.rb
+0
-11
spec/presenters/ci/trigger_schedule_presenter_spec.rb
spec/presenters/ci/trigger_schedule_presenter_spec.rb
+0
-64
No files found.
app/models/ci/trigger_schedule.rb
View file @
1dbc888e
...
...
@@ -2,7 +2,6 @@ module Ci
class
TriggerSchedule
<
ActiveRecord
::
Base
extend
Ci
::
Model
include
Importable
include
Presentable
acts_as_paranoid
...
...
app/presenters/ci/trigger_schedule_presenter.rb
deleted
100644 → 0
View file @
f229290a
module
Ci
class
TriggerSchedulePresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
presents
:trigger_schedule
def
real_next_run
(
worker_cron:
Settings
.
cron_jobs
[
'trigger_schedule_worker'
][
'cron'
],
worker_time_zone:
Time
.
zone
.
name
)
Gitlab
::
Ci
::
CronParser
.
new
(
worker_cron
,
worker_time_zone
)
.
next_time_from
(
next_run_at
)
end
end
end
spec/presenters/ci/trigger_schedule_presenter_spec.rb
deleted
100644 → 0
View file @
f229290a
require
'spec_helper'
describe
Ci
::
TriggerSchedulePresenter
do
let
(
:trigger_schedule
)
{
create
(
:ci_trigger_schedule
)
}
subject
(
:presenter
)
do
described_class
.
new
(
trigger_schedule
)
end
it
'inherits from Gitlab::View::Presenter::Delegated'
do
expect
(
described_class
.
superclass
).
to
eq
(
Gitlab
::
View
::
Presenter
::
Delegated
)
end
describe
'#initialize'
do
it
'takes a trigger_schedule and optional params'
do
expect
{
presenter
}.
not_to
raise_error
end
it
'exposes trigger_schedule'
do
expect
(
presenter
.
trigger_schedule
).
to
eq
(
trigger_schedule
)
end
it
'forwards missing methods to trigger_schedule'
do
expect
(
presenter
.
ref
).
to
eq
(
'master'
)
end
end
describe
'#real_next_run'
do
let
(
:trigger_schedule
)
{
create
(
:ci_trigger_schedule
,
cron:
user_cron
,
cron_time_zone:
'UTC'
)
}
subject
{
described_class
.
new
(
trigger_schedule
).
real_next_run
(
arguments
)
}
context
'when next_run_at > worker_next_time'
do
let
(
:arguments
)
{
{
worker_cron:
'0 0 1 1 *'
,
worker_time_zone:
'UTC'
}
}
# every 00:00, January 1st
let
(
:user_cron
)
{
'1 0 1 1 *'
}
# every 00:01, January 1st
it
'returns nearest worker_next_time from next_run_at'
do
is_expected
.
to
eq
(
Gitlab
::
Ci
::
CronParser
.
new
(
arguments
[
:worker_cron
],
arguments
[
:worker_time_zone
])
.
next_time_from
(
trigger_schedule
.
next_run_at
))
end
end
context
'when worker_next_time > next_run_at'
do
let
(
:arguments
)
{
{
worker_cron:
'1 0 1 1 *'
,
worker_time_zone:
'UTC'
}
}
# every 00:01, January 1st
let
(
:user_cron
)
{
'0 0 1 1 *'
}
# every 00:00, January 1st
it
'returns nearest worker_next_time from next_run_at'
do
is_expected
.
to
eq
(
Gitlab
::
Ci
::
CronParser
.
new
(
arguments
[
:worker_cron
],
arguments
[
:worker_time_zone
])
.
next_time_from
(
trigger_schedule
.
next_run_at
))
end
end
context
'when worker_cron and worker_time_zone are ommited'
do
let
(
:arguments
)
{
{}
}
let
(
:user_cron
)
{
'* * * * *'
}
# every minutes
it
'returns nearest worker_next_time from next_run_at by server configuration'
do
is_expected
.
to
eq
(
Gitlab
::
Ci
::
CronParser
.
new
(
Settings
.
cron_jobs
[
'trigger_schedule_worker'
][
'cron'
],
Time
.
zone
.
name
)
.
next_time_from
(
trigger_schedule
.
next_run_at
))
end
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