Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
30c6703f
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
30c6703f
编写于
12月 09, 2016
作者:
J
James Lopez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix specs
上级
982d5a05
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
25 deletion
+10
-25
lib/gitlab/cycle_analytics/base_event_fetcher.rb
lib/gitlab/cycle_analytics/base_event_fetcher.rb
+4
-4
lib/gitlab/cycle_analytics/summary/commit.rb
lib/gitlab/cycle_analytics/summary/commit.rb
+1
-1
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
+1
-1
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
+3
-10
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
+1
-9
未找到文件。
lib/gitlab/cycle_analytics/base_event_fetcher.rb
浏览文件 @
30c6703f
...
@@ -19,6 +19,10 @@ module Gitlab
...
@@ -19,6 +19,10 @@ module Gitlab
end
.
compact
end
.
compact
end
end
def
order
@order
||
default_order
end
private
private
def
update_author!
def
update_author!
...
@@ -37,10 +41,6 @@ module Gitlab
...
@@ -37,10 +41,6 @@ module Gitlab
base_query
.
project
(
extract_diff_epoch
(
diff_fn
).
as
(
'total_time'
),
*
projections
).
order
(
order
.
desc
)
base_query
.
project
(
extract_diff_epoch
(
diff_fn
).
as
(
'total_time'
),
*
projections
).
order
(
order
.
desc
)
end
end
def
order
@order
||
default_order
end
def
default_order
def
default_order
@options
[
:start_time_attrs
].
is_a?
(
Array
)
?
@options
[
:start_time_attrs
].
first
:
@options
[
:start_time_attrs
]
@options
[
:start_time_attrs
].
is_a?
(
Array
)
?
@options
[
:start_time_attrs
].
first
:
@options
[
:start_time_attrs
]
end
end
...
...
lib/gitlab/cycle_analytics/summary/commit.rb
浏览文件 @
30c6703f
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
cmd
<<
"--after=
#{
@from
.
iso8601
}
"
cmd
<<
"--after=
#{
@from
.
iso8601
}
"
cmd
<<
sha
cmd
<<
sha
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
{
|
io
|
io
.
read
}
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
raise
IOError
,
output
unless
status
.
zero?
raise
IOError
,
output
unless
status
.
zero?
...
...
spec/lib/gitlab/cycle_analytics/plan_event_fetcher_spec.rb
浏览文件 @
30c6703f
...
@@ -7,7 +7,7 @@ describe Gitlab::CycleAnalytics::PlanEventFetcher do
...
@@ -7,7 +7,7 @@ describe Gitlab::CycleAnalytics::PlanEventFetcher do
it_behaves_like
'default query config'
do
it_behaves_like
'default query config'
do
context
'no commits'
do
context
'no commits'
do
it
'does not blow up if there are no commits'
do
it
'does not blow up if there are no commits'
do
allow
_any_instance_of
(
Gitlab
::
CycleAnalytics
::
MetricsFetcher
).
to
receive
(
:events
).
and_return
([{}])
allow
(
event
).
to
receive
(
:event_result
).
and_return
([{}])
expect
{
event
.
fetch
}.
not_to
raise_error
expect
{
event
.
fetch
}.
not_to
raise_error
end
end
...
...
spec/lib/gitlab/cycle_analytics/shared_event_spec.rb
浏览文件 @
30c6703f
require
'spec_helper'
require
'spec_helper'
shared_examples
'default query config'
do
shared_examples
'default query config'
do
let
(
:fetcher
)
do
let
(
:project
)
{
create
(
:empty_project
)
}
Gitlab
::
CycleAnalytics
::
MetricsFetcher
.
new
(
project:
create
(
:empty_project
),
let
(
:event
)
{
described_class
.
new
(
project:
project
,
stage:
stage_name
,
options:
{
from:
1
.
day
.
ago
})
}
from:
1
.
day
.
ago
,
branch:
nil
,
stage:
stage_name
)
end
let
(
project
)
let
(
:event
)
{
described_class
.
new
(
project:
project
,
stage:
stage_name
,
options:
{})
}
it
'has the stage attribute'
do
it
'has the stage attribute'
do
expect
(
event
.
nam
e
).
not_to
be_nil
expect
(
event
.
stag
e
).
not_to
be_nil
end
end
it
'has the projection attributes'
do
it
'has the projection attributes'
do
...
...
spec/lib/gitlab/cycle_analytics/shared_stage_spec.rb
浏览文件 @
30c6703f
...
@@ -4,18 +4,10 @@ shared_examples 'base stage' do
...
@@ -4,18 +4,10 @@ shared_examples 'base stage' do
let
(
:stage
)
{
described_class
.
new
(
project:
double
,
options:
{})
}
let
(
:stage
)
{
described_class
.
new
(
project:
double
,
options:
{})
}
before
do
before
do
allow
_any_instance_of
(
Gitlab
::
CycleAnalytics
::
MetricsFetcher
).
to
receive
(
:median
).
and_return
(
1.12
)
allow
(
stage
).
to
receive
(
:median
).
and_return
(
1.12
)
allow_any_instance_of
(
Gitlab
::
CycleAnalytics
::
BaseEventFetcher
).
to
receive
(
:event_result
).
and_return
({})
allow_any_instance_of
(
Gitlab
::
CycleAnalytics
::
BaseEventFetcher
).
to
receive
(
:event_result
).
and_return
({})
end
end
it
'has the start attributes'
do
expect
(
stage
.
start_time_attrs
).
not_to
be_nil
end
it
'has the end attributes'
do
expect
(
stage
.
end_time_attrs
).
not_to
be_nil
end
it
'has the median data value'
do
it
'has the median data value'
do
expect
(
stage
.
median_data
[
:value
]).
not_to
be_nil
expect
(
stage
.
median_data
[
:value
]).
not_to
be_nil
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录