Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
cc4ef4da
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,体验更适合开发者的 AI 搜索 >>
提交
cc4ef4da
编写于
9月 09, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor CI tests
上级
76c6aeb9
变更
56
隐藏空白更改
内联
并排
Showing
56 changed file
with
122 addition
and
122 deletion
+122
-122
spec/ci/six.tar.gz
spec/ci/six.tar.gz
+0
-0
spec/controllers/ci/projects_controller_spec.rb
spec/controllers/ci/projects_controller_spec.rb
+9
-9
spec/factories/ci/trigger_requests.rb
spec/factories/ci/trigger_requests.rb
+2
-2
spec/factories/ci/triggers.rb
spec/factories/ci/triggers.rb
+1
-1
spec/features/ci/admin/builds_spec.rb
spec/features/ci/admin/builds_spec.rb
+0
-0
spec/features/ci/admin/events_spec.rb
spec/features/ci/admin/events_spec.rb
+0
-0
spec/features/ci/admin/projects_spec.rb
spec/features/ci/admin/projects_spec.rb
+0
-0
spec/features/ci/admin/runners_spec.rb
spec/features/ci/admin/runners_spec.rb
+0
-0
spec/features/ci/builds_spec.rb
spec/features/ci/builds_spec.rb
+0
-0
spec/features/ci/commits_spec.rb
spec/features/ci/commits_spec.rb
+0
-0
spec/features/ci/events_spec.rb
spec/features/ci/events_spec.rb
+0
-0
spec/features/ci/lint_spec.rb
spec/features/ci/lint_spec.rb
+0
-0
spec/features/ci/projects_spec.rb
spec/features/ci/projects_spec.rb
+0
-0
spec/features/ci/runners_spec.rb
spec/features/ci/runners_spec.rb
+0
-0
spec/features/ci/triggers_spec.rb
spec/features/ci/triggers_spec.rb
+0
-0
spec/features/ci/variables_spec.rb
spec/features/ci/variables_spec.rb
+0
-0
spec/helpers/ci/application_helper_spec.rb
spec/helpers/ci/application_helper_spec.rb
+1
-1
spec/helpers/ci/runners_helper_spec.rb
spec/helpers/ci/runners_helper_spec.rb
+1
-1
spec/helpers/ci/user_helper_spec.rb
spec/helpers/ci/user_helper_spec.rb
+1
-1
spec/helpers/ci/user_sessions_helper_spec.rb
spec/helpers/ci/user_sessions_helper_spec.rb
+1
-1
spec/lib/ci/ansi2html_spec.rb
spec/lib/ci/ansi2html_spec.rb
+0
-0
spec/lib/ci/charts_spec.rb
spec/lib/ci/charts_spec.rb
+0
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+0
-0
spec/lib/ci/upgrader_spec.rb
spec/lib/ci/upgrader_spec.rb
+0
-0
spec/mailers/ci/notify_spec.rb
spec/mailers/ci/notify_spec.rb
+0
-0
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+25
-25
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+35
-35
spec/models/ci/mail_service_spec.rb
spec/models/ci/mail_service_spec.rb
+20
-20
spec/models/ci/network_spec.rb
spec/models/ci/network_spec.rb
+0
-0
spec/models/ci/project_services/hip_chat_message_spec.rb
spec/models/ci/project_services/hip_chat_message_spec.rb
+5
-5
spec/models/ci/project_services/hip_chat_service_spec.rb
spec/models/ci/project_services/hip_chat_service_spec.rb
+1
-1
spec/models/ci/project_services/slack_message_spec.rb
spec/models/ci/project_services/slack_message_spec.rb
+3
-3
spec/models/ci/project_services/slack_service_spec.rb
spec/models/ci/project_services/slack_service_spec.rb
+1
-1
spec/models/ci/project_spec.rb
spec/models/ci/project_spec.rb
+0
-0
spec/models/ci/runner_project_spec.rb
spec/models/ci/runner_project_spec.rb
+1
-1
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+1
-1
spec/models/ci/service_spec.rb
spec/models/ci/service_spec.rb
+1
-1
spec/models/ci/trigger_spec.rb
spec/models/ci/trigger_spec.rb
+1
-1
spec/models/ci/user_spec.rb
spec/models/ci/user_spec.rb
+1
-1
spec/models/ci/variable_spec.rb
spec/models/ci/variable_spec.rb
+1
-1
spec/models/ci/web_hook_spec.rb
spec/models/ci/web_hook_spec.rb
+1
-1
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+1
-1
spec/requests/ci/api/commits_spec.rb
spec/requests/ci/api/commits_spec.rb
+1
-1
spec/requests/ci/api/forks_spec.rb
spec/requests/ci/api/forks_spec.rb
+1
-1
spec/requests/ci/api/projects_spec.rb
spec/requests/ci/api/projects_spec.rb
+4
-4
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+1
-1
spec/requests/ci/api/triggers_spec.rb
spec/requests/ci/api/triggers_spec.rb
+1
-1
spec/requests/ci/builds_spec.rb
spec/requests/ci/builds_spec.rb
+0
-0
spec/requests/ci/commits_spec.rb
spec/requests/ci/commits_spec.rb
+0
-0
spec/services/ci/create_commit_service_spec.rb
spec/services/ci/create_commit_service_spec.rb
+0
-0
spec/services/ci/create_project_service_spec.rb
spec/services/ci/create_project_service_spec.rb
+0
-0
spec/services/ci/create_trigger_request_service_spec.rb
spec/services/ci/create_trigger_request_service_spec.rb
+0
-0
spec/services/ci/event_service_spec.rb
spec/services/ci/event_service_spec.rb
+0
-0
spec/services/ci/image_for_build_service_spec.rb
spec/services/ci/image_for_build_service_spec.rb
+0
-0
spec/services/ci/register_build_service_spec.rb
spec/services/ci/register_build_service_spec.rb
+0
-0
spec/services/ci/web_hook_service_spec.rb
spec/services/ci/web_hook_service_spec.rb
+0
-0
未找到文件。
spec/ci/six.tar.gz
已删除
100644 → 0
浏览文件 @
76c6aeb9
文件已删除
spec/controllers/ci/projects_controller_spec.rb
浏览文件 @
cc4ef4da
require
"spec_helper"
describe
ProjectsController
do
describe
Ci
::
ProjectsController
do
before
do
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
end
describe
"POST #build"
do
...
...
@@ -55,25 +55,25 @@ describe ProjectsController do
end
let
(
:user
)
do
User
.
new
(
user_data
)
Ci
::
User
.
new
(
user_data
)
end
it
"creates project"
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
Network
.
any_instance
.
stub
(
:enable_ci
).
and_return
(
true
)
Network
.
any_instance
.
stub
(
:project_hooks
).
and_return
(
true
)
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:enable_ci
).
and_return
(
true
)
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:project_hooks
).
and_return
(
true
)
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
expect
(
response
.
code
).
to
eq
(
'302'
)
expect
(
assigns
(
:project
)).
not_to
be_a_new
(
Project
)
expect
(
assigns
(
:project
)).
not_to
be_a_new
(
Ci
::
Project
)
end
it
"shows error"
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
User
.
any_instance
.
stub
(
:can_manage_project?
).
and_return
(
false
)
allow_any_instance_of
(
Ci
::
User
).
to
receive
(
:can_manage_project?
).
and_return
(
false
)
post
:create
,
{
project:
JSON
.
dump
(
project_dump
.
to_h
)
}.
with_indifferent_access
...
...
@@ -91,13 +91,13 @@ describe ProjectsController do
end
let
(
:user
)
do
User
.
new
(
user_data
)
Ci
::
User
.
new
(
user_data
)
end
it
"searches projects"
do
allow
(
controller
).
to
receive
(
:reset_cache
)
{
true
}
allow
(
controller
).
to
receive
(
:current_user
)
{
user
}
Network
.
any_instance
.
should_
receive
(
:projects
).
with
(
hash_including
(
search:
'str'
),
:authorized
)
allow_any_instance_of
(
Ci
::
Network
).
to
receive
(
:projects
).
with
(
hash_including
(
search:
'str'
),
:authorized
)
xhr
:get
,
:gitlab
,
{
search:
"str"
,
format:
"js"
}.
with_indifferent_access
...
...
spec/factories/ci/trigger_requests.rb
浏览文件 @
cc4ef4da
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl
.
define
do
factory
:trigger_request
do
factory
:trigger_request_with_variables
do
factory
:
ci_
trigger_request
do
factory
:
ci_
trigger_request_with_variables
do
variables
do
{
TRIGGER_KEY
:
'TRIGGER_VALUE'
...
...
spec/factories/ci/triggers.rb
浏览文件 @
cc4ef4da
...
...
@@ -2,7 +2,7 @@
FactoryGirl
.
define
do
factory
:ci_trigger_without_token
,
class:
Ci
::
Trigger
do
factory
:trigger
do
factory
:
ci_
trigger
do
token
'token'
end
end
...
...
spec/
ci/features
/admin/builds_spec.rb
→
spec/
features/ci
/admin/builds_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/admin/events_spec.rb
→
spec/
features/ci
/admin/events_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/admin/projects_spec.rb
→
spec/
features/ci
/admin/projects_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/admin/runners_spec.rb
→
spec/
features/ci
/admin/runners_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/builds_spec.rb
→
spec/
features/ci
/builds_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/commits_spec.rb
→
spec/
features/ci
/commits_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/events_spec.rb
→
spec/
features/ci
/events_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/lint_spec.rb
→
spec/
features/ci
/lint_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/projects_spec.rb
→
spec/
features/ci
/projects_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/runners_spec.rb
→
spec/
features/ci
/runners_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/triggers_spec.rb
→
spec/
features/ci
/triggers_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/features
/variables_spec.rb
→
spec/
features/ci
/variables_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/helpers
/application_helper_spec.rb
→
spec/
helpers/ci
/application_helper_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
ApplicationHelper
do
describe
Ci
::
ApplicationHelper
do
describe
"#duration_in_words"
do
it
"returns minutes and seconds"
do
intervals_in_words
=
{
...
...
spec/
ci/helpers
/runners_helper_spec.rb
→
spec/
helpers/ci
/runners_helper_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
RunnersHelper
do
describe
Ci
::
RunnersHelper
do
it
"returns - not contacted yet"
do
runner
=
FactoryGirl
.
build
:runner
runner_status_icon
(
runner
).
should
include
(
"not connected yet"
)
...
...
spec/
ci/helpers
/user_helper_spec.rb
→
spec/
helpers/ci
/user_helper_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
UserHelper
do
describe
Ci
::
UserHelper
do
describe
:user_avatar_url
do
let
(
:user
)
{
User
.
new
({
'avatar_url'
=>
avatar_url
})
}
...
...
spec/
ci/helpers
/user_sessions_helper_spec.rb
→
spec/
helpers/ci
/user_sessions_helper_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
UserSessionsHelper
do
describe
Ci
::
UserSessionsHelper
do
describe
:generate_oauth_hmac
do
let
(
:salt
)
{
'a'
}
let
(
:salt2
)
{
'b'
}
...
...
spec/
ci/lib
/ansi2html_spec.rb
→
spec/
lib/ci
/ansi2html_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/lib
/charts_spec.rb
→
spec/
lib/ci
/charts_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/lib
/gitlab_ci_yaml_processor_spec.rb
→
spec/
lib/ci
/gitlab_ci_yaml_processor_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/lib
/upgrader_spec.rb
→
spec/
lib/ci
/upgrader_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/mailers
/notify_spec.rb
→
spec/
mailers/ci
/notify_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/models
/build_spec.rb
→
spec/
models/ci
/build_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -25,10 +25,10 @@
require
'spec_helper'
describe
Build
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
}
describe
Ci
::
Build
do
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
}
it
{
should
belong_to
(
:commit
)
}
it
{
should
validate_presence_of
:status
}
...
...
@@ -40,12 +40,12 @@ describe Build do
it
{
should
respond_to
:trace_html
}
describe
:first_pending
do
let
(
:first
)
{
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
}
let
(
:second
)
{
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
'pending'
}
let
(
:first
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
'pending'
,
created_at:
Date
.
yesterday
}
let
(
:second
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
'pending'
}
before
{
first
;
second
}
subject
{
Build
.
first_pending
}
subject
{
Ci
::
Build
.
first_pending
}
it
{
should
be_a
(
Build
)
}
it
{
should
be_a
(
Ci
::
Build
)
}
it
(
'returns with the first pending build'
)
{
should
eq
(
first
)
}
end
...
...
@@ -54,12 +54,12 @@ describe Build do
build
.
status
=
'success'
build
.
save
end
let
(
:create_from_build
)
{
Build
.
create_from
build
}
let
(
:create_from_build
)
{
Ci
::
Build
.
create_from
build
}
it
(
'there should be a pending task'
)
do
expect
(
Build
.
pending
.
count
(
:all
)).
to
eq
0
expect
(
Ci
::
Build
.
pending
.
count
(
:all
)).
to
eq
0
create_from_build
expect
(
Build
.
pending
.
count
(
:all
)).
to
be
>
0
expect
(
Ci
::
Build
.
pending
.
count
(
:all
)).
to
be
>
0
end
end
...
...
@@ -69,14 +69,14 @@ describe Build do
context
'without started_at'
do
before
{
build
.
started_at
=
nil
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
%w(running success failed)
.
each
do
|
status
|
context
"if build status is
#{
status
}
"
do
before
{
build
.
status
=
status
}
it
{
should
be_tru
e
}
it
{
should
be_tru
thy
}
end
end
...
...
@@ -84,7 +84,7 @@ describe Build do
context
"if build status is
#{
status
}
"
do
before
{
build
.
status
=
status
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
end
end
...
...
@@ -96,7 +96,7 @@ describe Build do
context
"if build.status is
#{
state
}
"
do
before
{
build
.
status
=
state
}
it
{
should
be_tru
e
}
it
{
should
be_tru
thy
}
end
end
...
...
@@ -104,7 +104,7 @@ describe Build do
context
"if build.status is
#{
state
}
"
do
before
{
build
.
status
=
state
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
end
end
...
...
@@ -116,7 +116,7 @@ describe Build do
context
"if build.status is
#{
state
}
"
do
before
{
build
.
status
=
state
}
it
{
should
be_tru
e
}
it
{
should
be_tru
thy
}
end
end
...
...
@@ -124,7 +124,7 @@ describe Build do
context
"if build.status is
#{
state
}
"
do
before
{
build
.
status
=
state
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
end
end
...
...
@@ -138,13 +138,13 @@ describe Build do
context
'and build.status is success'
do
before
{
build
.
status
=
'success'
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
context
'and build.status is failed'
do
before
{
build
.
status
=
'failed'
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
end
...
...
@@ -154,13 +154,13 @@ describe Build do
context
'and build.status is success'
do
before
{
build
.
status
=
'success'
}
it
{
should
be_false
}
it
{
should
be_false
y
}
end
context
'and build.status is failed'
do
before
{
build
.
status
=
'failed'
}
it
{
should
be_tru
e
}
it
{
should
be_tru
thy
}
end
end
end
...
...
@@ -324,14 +324,14 @@ describe Build do
}
before
do
build
.
project
.
variables
<<
Variable
.
new
(
key:
'SECRET_KEY'
,
value:
'secret_value'
)
build
.
project
.
variables
<<
Ci
::
Variable
.
new
(
key:
'SECRET_KEY'
,
value:
'secret_value'
)
end
it
{
should
eq
(
variables
+
secure_variables
)
}
context
'and trigger variables'
do
let
(
:trigger
)
{
FactoryGirl
.
create
:trigger
,
project:
project
}
let
(
:trigger_request
)
{
FactoryGirl
.
create
:trigger_request_with_variables
,
commit:
commit
,
trigger:
trigger
}
let
(
:trigger
)
{
FactoryGirl
.
create
:
ci_
trigger
,
project:
project
}
let
(
:trigger_request
)
{
FactoryGirl
.
create
:
ci_
trigger_request_with_variables
,
commit:
commit
,
trigger:
trigger
}
let
(
:trigger_variables
)
{
[
{
key: :TRIGGER_KEY
,
value:
'TRIGGER_VALUE'
,
public:
false
}
...
...
spec/
ci/models
/commit_spec.rb
→
spec/
models/ci
/commit_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -17,10 +17,10 @@
require
'spec_helper'
describe
Commit
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:commit_with_project
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
describe
C
i
::
C
ommit
do
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:commit_with_project
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:config_processor
)
{
GitlabCiYamlProcessor
.
new
(
gitlab_ci_yaml
)
}
it
{
should
belong_to
(
:project
)
}
...
...
@@ -37,18 +37,18 @@ describe Commit do
describe
:last_build
do
subject
{
commit
.
last_build
}
before
do
@first
=
FactoryGirl
.
create
:build
,
commit:
commit
,
created_at:
Date
.
yesterday
@second
=
FactoryGirl
.
create
:build
,
commit:
commit
@first
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
created_at:
Date
.
yesterday
@second
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
end
it
{
should
be_a
(
Build
)
}
it
{
should
be_a
(
Ci
::
Build
)
}
it
(
'returns with the most recently created build'
)
{
should
eq
(
@second
)
}
end
describe
:retry
do
before
do
@first
=
FactoryGirl
.
create
:build
,
commit:
commit
,
created_at:
Date
.
yesterday
@second
=
FactoryGirl
.
create
:build
,
commit:
commit
@first
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
created_at:
Date
.
yesterday
@second
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
end
it
"creates new build"
do
...
...
@@ -62,38 +62,38 @@ describe Commit do
context
'always sending notification'
do
it
'should return commit_pusher_email as only recipient when no additional recipients are given'
do
project
=
FactoryGirl
.
create
:project
,
project
=
FactoryGirl
.
create
:
ci_
project
,
email_add_pusher:
true
,
email_recipients:
''
commit
=
FactoryGirl
.
create
:commit
,
project:
project
commit
=
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
expected
=
'commit_pusher_email'
commit
.
stub
(
:push_data
)
{
{
user_email:
expected
}
}
commit
.
project_recipients
.
should
==
[
expected
]
end
it
'should return commit_pusher_email and additional recipients'
do
project
=
FactoryGirl
.
create
:project
,
project
=
FactoryGirl
.
create
:
ci_
project
,
email_add_pusher:
true
,
email_recipients:
'rec1 rec2'
commit
=
FactoryGirl
.
create
:commit
,
project:
project
commit
=
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
expected
=
'commit_pusher_email'
commit
.
stub
(
:push_data
)
{
{
user_email:
expected
}
}
commit
.
project_recipients
.
should
==
[
'rec1'
,
'rec2'
,
expected
]
end
it
'should return recipients'
do
project
=
FactoryGirl
.
create
:project
,
project
=
FactoryGirl
.
create
:
ci_
project
,
email_add_pusher:
false
,
email_recipients:
'rec1 rec2'
commit
=
FactoryGirl
.
create
:commit
,
project:
project
commit
=
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
commit
.
project_recipients
.
should
==
[
'rec1'
,
'rec2'
]
end
it
'should return unique recipients only'
do
project
=
FactoryGirl
.
create
:project
,
project
=
FactoryGirl
.
create
:
ci_
project
,
email_add_pusher:
true
,
email_recipients:
'rec1 rec1 rec2'
commit
=
FactoryGirl
.
create
:commit
,
project:
project
commit
=
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
expected
=
'rec2'
commit
.
stub
(
:push_data
)
{
{
user_email:
expected
}
}
commit
.
project_recipients
.
should
==
[
'rec1'
,
'rec2'
]
...
...
@@ -168,8 +168,8 @@ describe Commit do
end
context
'for build triggers'
do
let
(
:trigger
)
{
FactoryGirl
.
create
:trigger
,
project:
project
}
let
(
:trigger_request
)
{
FactoryGirl
.
create
:trigger_request
,
commit:
commit
,
trigger:
trigger
}
let
(
:trigger
)
{
FactoryGirl
.
create
:
ci_
trigger
,
project:
project
}
let
(
:trigger_request
)
{
FactoryGirl
.
create
:
ci_
trigger_request
,
commit:
commit
,
trigger:
trigger
}
it
'creates builds'
do
commit
.
create_builds
(
trigger_request
).
should
be_true
...
...
@@ -215,49 +215,49 @@ describe Commit do
end
describe
"#finished_at"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
it
"returns finished_at of latest build"
do
build
=
FactoryGirl
.
create
:build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build1
=
FactoryGirl
.
create
:build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
build
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build1
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
commit
.
finished_at
.
to_i
.
should
==
build
.
finished_at
.
to_i
end
it
"returns nil if there is no finished build"
do
build
=
FactoryGirl
.
create
:not_started_build
,
commit:
commit
build
=
FactoryGirl
.
create
:
ci_
not_started_build
,
commit:
commit
commit
.
finished_at
.
should
be_nil
end
end
describe
"coverage"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
,
coverage_regex:
"/.*/"
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
,
coverage_regex:
"/.*/"
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
it
"calculates average when there are two builds with coverage"
do
FactoryGirl
.
create
:build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
commit
.
coverage
.
should
==
"35.00"
end
it
"calculates average when there are two builds with coverage and one with nil"
do
FactoryGirl
.
create
:build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
FactoryGirl
.
create
:build
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
commit
.
coverage
.
should
==
"35.00"
end
it
"calculates average when there are two builds with coverage and one is retried"
do
FactoryGirl
.
create
:build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:build
,
name:
"rubocop"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rspec"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rubocop"
,
coverage:
30
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
name:
"rubocop"
,
coverage:
40
,
commit:
commit
commit
.
coverage
.
should
==
"35.00"
end
it
"calculates average when there is one build without coverage"
do
FactoryGirl
.
create
:build
,
commit:
commit
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
commit
.
coverage
.
should
be_nil
end
end
...
...
spec/
ci/models
/mail_service_spec.rb
→
spec/
models/ci
/mail_service_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -14,7 +14,7 @@
require
'spec_helper'
describe
MailService
do
describe
Ci
::
MailService
do
describe
"Associations"
do
it
{
should
belong_to
:project
}
end
...
...
@@ -28,12 +28,12 @@ describe MailService do
end
describe
'Sends email for'
do
let
(
:mail
)
{
MailService
.
new
}
let
(
:mail
)
{
Ci
::
MailService
.
new
}
describe
'failed build'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
email_add_pusher:
true
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :failed
,
commit:
commit
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :failed
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
@@ -53,9 +53,9 @@ describe MailService do
end
describe
'successfull build'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
email_add_pusher:
true
,
email_only_broken_builds:
false
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :success
,
commit:
commit
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
,
email_only_broken_builds:
false
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :success
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
@@ -76,13 +76,13 @@ describe MailService do
describe
'successfull build and project has email_recipients'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
,
email_only_broken_builds:
false
,
email_recipients:
"jeroen@example.com"
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :success
,
commit:
commit
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :success
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
@@ -104,13 +104,13 @@ describe MailService do
describe
'successful build and notify only broken builds'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
,
email_only_broken_builds:
true
,
email_recipients:
"jeroen@example.com"
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :success
,
commit:
commit
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :success
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
@@ -132,13 +132,13 @@ describe MailService do
describe
'successful build and can test service'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
,
email_only_broken_builds:
false
,
email_recipients:
"jeroen@example.com"
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :success
,
commit:
commit
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :success
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
@@ -154,13 +154,13 @@ describe MailService do
describe
'retried build should not receive email'
do
let
(
:project
)
{
FactoryGirl
.
create
(
:project
,
FactoryGirl
.
create
(
:
ci_
project
,
email_add_pusher:
true
,
email_only_broken_builds:
true
,
email_recipients:
"jeroen@example.com"
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:build
,
status: :failed
,
commit:
commit
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
project
)
}
let
(
:build
)
{
FactoryGirl
.
create
(
:
ci_
build
,
status: :failed
,
commit:
commit
)
}
before
do
mail
.
stub
(
...
...
spec/
ci/models
/network_spec.rb
→
spec/
models/ci
/network_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/models
/project_services/hip_chat_message_spec.rb
→
spec/
models/ci
/project_services/hip_chat_message_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
HipChatMessage
do
describe
Ci
::
HipChatMessage
do
subject
{
HipChatMessage
.
new
(
build
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
...
...
@@ -8,7 +8,7 @@ describe HipChatMessage do
context
"One build"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_one_job
,
project:
project
)
}
let
(
:build
)
do
let
(
:build
)
do
commit
.
create_builds
commit
.
builds
.
first
end
...
...
@@ -16,7 +16,7 @@ describe HipChatMessage do
context
'when build succeeds'
do
it
'returns a successful message'
do
build
.
update
(
status:
"success"
)
expect
(
subject
.
status_color
).
to
eq
'green'
expect
(
subject
.
notify?
).
to
be_false
expect
(
subject
.
to_s
).
to
match
(
/Build '[^']+' #\d+/
)
...
...
@@ -39,7 +39,7 @@ describe HipChatMessage do
context
"Several builds"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_two_jobs
,
project:
project
)
}
let
(
:build
)
do
let
(
:build
)
do
commit
.
builds
.
first
end
...
...
@@ -63,7 +63,7 @@ describe HipChatMessage do
second_build
=
commit
.
builds
.
last
first_build
.
update
(
status:
"success"
)
second_build
.
update
(
status:
"failed"
)
expect
(
subject
.
status_color
).
to
eq
'red'
expect
(
subject
.
notify?
).
to
be_true
expect
(
subject
.
to_s
).
to
match
(
/Commit #\d+/
)
...
...
spec/
ci/models
/project_services/hip_chat_service_spec.rb
→
spec/
models/ci
/project_services/hip_chat_service_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -15,7 +15,7 @@
require
'spec_helper'
describe
HipChatService
do
describe
Ci
::
HipChatService
do
describe
"Validations"
do
...
...
spec/
ci/models
/project_services/slack_message_spec.rb
→
spec/
models/ci
/project_services/slack_message_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
SlackMessage
do
describe
Ci
::
SlackMessage
do
subject
{
SlackMessage
.
new
(
commit
)
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
...
...
@@ -8,7 +8,7 @@ describe SlackMessage do
context
"One build"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_one_job
,
project:
project
)
}
let
(
:build
)
do
let
(
:build
)
do
commit
.
create_builds
commit
.
builds
.
first
end
...
...
@@ -70,7 +70,7 @@ describe SlackMessage do
second_build
=
commit
.
builds
.
last
first_build
.
update
(
status:
"success"
)
second_build
.
update
(
status:
"failed"
)
subject
.
color
.
should
==
color
subject
.
fallback
.
should
include
(
'Commit'
)
subject
.
fallback
.
should
include
(
"
\#
#{
commit
.
id
}
"
)
...
...
spec/
ci/models
/project_services/slack_service_spec.rb
→
spec/
models/ci
/project_services/slack_service_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -14,7 +14,7 @@
require
'spec_helper'
describe
SlackService
do
describe
Ci
::
SlackService
do
describe
"Associations"
do
it
{
should
belong_to
:project
}
end
...
...
spec/
ci/models
/project_spec.rb
→
spec/
models/ci
/project_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/models
/runner_project_spec.rb
→
spec/
models/ci
/runner_project_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -11,6 +11,6 @@
require
'spec_helper'
describe
RunnerProject
do
describe
Ci
::
RunnerProject
do
pending
"add some examples to (or delete)
#{
__FILE__
}
"
end
spec/
ci/models
/runner_spec.rb
→
spec/
models/ci
/runner_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -19,7 +19,7 @@
require
'spec_helper'
describe
Runner
do
describe
Ci
::
Runner
do
describe
'#display_name'
do
it
'should return the description if it has a value'
do
runner
=
FactoryGirl
.
build
(
:runner
,
description:
'Linux/Ruby-1.9.3-p448'
)
...
...
spec/
ci/models
/service_spec.rb
→
spec/
models/ci
/service_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -14,7 +14,7 @@
require
'spec_helper'
describe
Service
do
describe
Ci
::
Service
do
describe
"Associations"
do
it
{
should
belong_to
:project
}
...
...
spec/
ci/models
/trigger_spec.rb
→
spec/
models/ci
/trigger_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
Trigger
do
describe
Ci
::
Trigger
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
describe
'before_validation'
do
...
...
spec/
ci/models
/user_spec.rb
→
spec/
models/ci
/user_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
User
do
describe
Ci
::
User
do
describe
"has_developer_access?"
do
before
do
...
...
spec/
ci/models
/variable_spec.rb
→
spec/
models/ci
/variable_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -13,7 +13,7 @@
require
'spec_helper'
describe
Variable
do
describe
Ci
::
Variable
do
subject
{
Variable
.
new
}
let
(
:secret_value
)
{
'secret'
}
...
...
spec/
ci/models
/web_hook_spec.rb
→
spec/
models/ci
/web_hook_spec.rb
浏览文件 @
cc4ef4da
...
...
@@ -11,7 +11,7 @@
require
'spec_helper'
describe
WebHook
do
describe
Ci
::
WebHook
do
describe
"Associations"
do
it
{
should
belong_to
:project
}
end
...
...
spec/
ci/requests
/api/builds_spec.rb
→
spec/
requests/ci
/api/builds_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
do
describe
Ci
::
API
::
API
do
include
ApiHelpers
let
(
:runner
)
{
FactoryGirl
.
create
(
:runner
,
tag_list:
[
"mysql"
,
"ruby"
])
}
...
...
spec/
ci/requests
/api/commits_spec.rb
→
spec/
requests/ci
/api/commits_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
,
'Commits'
do
describe
Ci
::
API
::
API
,
'Commits'
do
include
ApiHelpers
let
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
...
...
spec/
ci/requests
/api/forks_spec.rb
→
spec/
requests/ci
/api/forks_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
do
describe
Ci
::
API
::
API
do
include
ApiHelpers
let
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
...
...
spec/
ci/requests
/api/projects_spec.rb
→
spec/
requests/ci
/api/projects_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
do
describe
Ci
::
API
::
API
do
include
ApiHelpers
let
(
:gitlab_url
)
{
GitlabCi
.
config
.
gitlab_server
.
url
}
...
...
@@ -12,11 +12,11 @@ describe API::API do
url:
gitlab_url
}
}
before
{
stub_gitlab_calls
}
context
"requests for scoped projects"
do
# NOTE: These ids are tied to the actual projects on demo.gitlab.com
describe
"GET /projects"
do
...
...
@@ -45,7 +45,7 @@ describe API::API do
end
end
end
describe
"POST /projects/:project_id/webhooks"
do
let!
(
:project
)
{
FactoryGirl
.
create
(
:project
)
}
...
...
spec/
ci/requests
/api/runners_spec.rb
→
spec/
requests/ci
/api/runners_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
do
describe
Ci
::
API
::
API
do
include
ApiHelpers
include
StubGitlabCalls
...
...
spec/
ci/requests
/api/triggers_spec.rb
→
spec/
requests/ci
/api/triggers_spec.rb
浏览文件 @
cc4ef4da
require
'spec_helper'
describe
API
::
API
do
describe
Ci
::
API
::
API
do
include
ApiHelpers
describe
'POST /projects/:project_id/refs/:ref/trigger'
do
...
...
spec/
ci/requests
/builds_spec.rb
→
spec/
requests/ci
/builds_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/requests
/commits_spec.rb
→
spec/
requests/ci
/commits_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/create_commit_service_spec.rb
→
spec/
services/ci
/create_commit_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/create_project_service_spec.rb
→
spec/
services/ci
/create_project_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/create_trigger_request_service_spec.rb
→
spec/
services/ci
/create_trigger_request_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/event_service_spec.rb
→
spec/
services/ci
/event_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/image_for_build_service_spec.rb
→
spec/
services/ci
/image_for_build_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/register_build_service_spec.rb
→
spec/
services/ci
/register_build_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
spec/
ci/services
/web_hook_service_spec.rb
→
spec/
services/ci
/web_hook_service_spec.rb
浏览文件 @
cc4ef4da
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录